Click or drag to resize
gmp_libmpn_cmp Method
Compare {s1p, n} and {s2p, 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 int mpn_cmp(
	mp_ptr s1p,
	mp_ptr s2p,
	mp_size_t n
)

Parameters

s1p
Type: Math.Gmp.Nativemp_ptr
The first operand integer.
s2p
Type: Math.Gmp.Nativemp_ptr
The second operand integer.
n
Type: Math.Gmp.Nativemp_size_t
The number of limbs in s1p and s2p.

Return Value

Type: Int32
Return a positive value if s1 > s2, 0 if they are equal, or a negative value if s1 < s2.
Examples
// Create multi-precision operands, and expected result.
mp_ptr s1p = new mp_ptr(new uint[] { 0xffffffff, 0xffffffff });
mp_ptr s2p = new mp_ptr(new uint[] { 0x00000001, 0x00000000 });

// Assert s1p > s2p.
Assert.IsTrue(gmp_lib.mpn_cmp(s1p, s2p, s1p.Size) > 0);

// Release unmanaged memory.
gmp_lib.free(s1p, s2p);
See Also