Click or drag to resize
gmp_libmpz_tstbit Method
Test bit bit_index in op and return 0 or 1 accordingly.

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 int mpz_tstbit(
	mpz_t op,
	mp_bitcnt_t bit_index
)

Parameters

op
Type: Math.Gmp.Nativempz_t
bit_index
Type: Math.Gmp.Nativemp_bitcnt_t

Return Value

Type: Int32
Test bit bit_index in op and return 0 or 1 accordingly.
Remarks

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 rop to 70.
mpz_t rop = new mpz_t();
gmp_lib.mpz_init_set_si(rop, 70);

// Assert that bit 3 of rop is 0.
Assert.IsTrue(gmp_lib.mpz_tstbit(rop, 3U) == 0);

// Release unmanaged memory allocated for rop.
gmp_lib.mpz_clear(rop);
See Also