Click or drag to resize
gmp_libmpz_size Method
Return the size of op measured in number of limbs.

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_size_t mpz_size(
	mpz_t op
)

Parameters

op
Type: Math.Gmp.Nativempz_t
The operand integer.

Return Value

Type: mp_size_t
The size of op measured in number of limbs.
Remarks

If op is zero, the returned value will be zero.

Examples
// Create and initialize new integer x.
mpz_t op = new mpz_t();
char_ptr value = new char_ptr("1000 ABCD 1234 7AB8 24FD");
gmp_lib.mpz_init_set_str(op, value, 16);

// Assert the value of the limbs of op.
if (gmp_lib.mp_bytes_per_limb == 4)
    Assert.IsTrue(gmp_lib.mpz_size(op) == 3);
else // gmp_lib.mp_bytes_per_limb == 8
    Assert.IsTrue(gmp_lib.mpz_size(op) == 2);

// Release unmanaged memory allocated for op and value.
gmp_lib.mpz_clear(op);
gmp_lib.free(value);
See Also