Click or drag to resize
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
)

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);
See Also