GMP Native Interface for .NET
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)

public static mp_size_t mpz_size( mpz_t op )
Public Shared Function mpz_size ( op As mpz_t ) As mp_size_t
public: static mp_size_t mpz_size( mpz_t^ op )
static member mpz_size : op : mpz_t -> mp_size_t
Parameters
- op
- Type: Math.Gmp.Nativempz_t
The operand integer.
Return Value
Type: mp_size_tThe size of op measured in number of limbs.

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

// 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);
' Create and initialize new integer x. Dim op As New mpz_t() Dim value As 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 Then Assert.IsTrue(gmp_lib.mpz_size(op) = 3) Else ' gmp_lib.mp_bytes_per_limb == 8 Assert.IsTrue(gmp_lib.mpz_size(op) = 2) End If ' Release unmanaged memory allocated for op and value. gmp_lib.mpz_clear(op) gmp_lib.free(value)
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.
