gmp_lib.mpz_scan0 Method

GMP Native Interface for .NET

gmp_libmpz_scan0 Method
Scan op for 0 bit.

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_bitcnt_t mpz_scan0(
	mpz_t op,
	mp_bitcnt_t starting_bit
)
Public Shared Function mpz_scan0 ( 
	op As mpz_t,
	starting_bit As mp_bitcnt_t
) As mp_bitcnt_t
public:
static mp_bitcnt_t mpz_scan0(
	mpz_t^ op, 
	mp_bitcnt_t starting_bit
)
static member mpz_scan0 : 
        op : mpz_t * 
        starting_bit : mp_bitcnt_t -> mp_bitcnt_t 

Parameters

op
Type: Math.Gmp.Nativempz_t
The operand integer.
starting_bit
Type: Math.Gmp.Nativemp_bitcnt_t
The start bit index position.

Return Value

Type: mp_bitcnt_t
Return the index of the found bit.
Remarks

Scan op, starting from bit starting_bit, towards more significant bits, until the first 0 bit is found. Return the index of the found bit.

If the bit at starting_bit is already what’s sought, then starting_bit is returned.

If there’s no bit found, then the largest possible mp_bitcnt_t is returned. This will happen in mpz_scan0 past the end of a negative number, or mpz_scan1 past the end of a nonnegative number.

The function behaves as if twos complement arithmetic were used (although sign-magnitude is the actual implementation). The least significant bit is number 0.

Examples
// Create, initialize, and set the value of op to 70.
mpz_t op = new mpz_t();
gmp_lib.mpz_init_set_ui(op, 70U);

// Assert that the first 0 bit starting from bit 1 in op is bit 3.
Assert.IsTrue(gmp_lib.mpz_scan0(op, 1U) == 3U);

// Release unmanaged memory allocated for op.
gmp_lib.mpz_clear(op);
' Create, initialize, and set the value of op to 70.
Dim op As New mpz_t()
gmp_lib.mpz_init_set_ui(op, 70UI)

' Assert that the first 0 bit starting from bit 1 in op is bit 3.
Assert.IsTrue(gmp_lib.mpz_scan0(op, 1UI) = 3UI)

' Release unmanaged memory allocated for op.
gmp_lib.mpz_clear(op)

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