Perform the negation of {sp, n}, and write the result to {rp, n}.
Namespace:
Math.Gmp.Native
Assembly:
Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public static mp_limb_t mpn_neg(
mp_ptr rp,
mp_ptr sp,
mp_size_t n
)
Public Shared Function mpn_neg (
rp As mp_ptr,
sp As mp_ptr,
n As mp_size_t
) As mp_limb_t
public:
static mp_limb_t mpn_neg(
mp_ptr^ rp,
mp_ptr^ sp,
mp_size_t n
)
static member mpn_neg :
rp : mp_ptr *
sp : mp_ptr *
n : mp_size_t -> mp_limb_t
Parameters
- rp
- Type: Math.Gmp.Nativemp_ptr
The result integer. - sp
- Type: Math.Gmp.Nativemp_ptr
The operand integer. - n
- Type: Math.Gmp.Nativemp_size_t
The number of limbs of sp and rp.
Return Value
Type:
mp_limb_tReturn borrow, either 0 or 1.
Remarks
This is equivalent to calling mpn_sub_n with a n-limb
zero minuend and passing {sp, n} as subtrahend.
Examples
mp_ptr sp = new mp_ptr(new uint[] { 0xffffffff, 0xffffffff });
mp_ptr rp = new mp_ptr(new uint[2]);
mp_ptr result = new mp_ptr(new uint[] { 0x0000001, 0x00000000 });
mp_limb_t borrow = gmp_lib.mpn_neg(rp, sp, sp.Size);
Assert.IsTrue(borrow == 1);
Assert.IsTrue(rp.SequenceEqual(result));
gmp_lib.free(rp, sp, result);
Dim sp As New mp_ptr(New UInteger() { &HffffffffUI, &HffffffffUI})
Dim rp As New mp_ptr(New UInteger(1) { })
Dim result As New mp_ptr(New UInteger() { &H1, &H0})
Dim borrow As mp_limb_t = gmp_lib.mpn_neg(rp, sp, sp.Size)
Assert.IsTrue(borrow = 1)
Assert.IsTrue(rp.SequenceEqual(result))
gmp_lib.free(rp, sp, result)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also