gmp_libmpz_scan0 Method |
Namespace: Math.Gmp.Native
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.
// 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);