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

public static int mpz_tstbit( mpz_t op, mp_bitcnt_t bit_index )
Public Shared Function mpz_tstbit ( op As mpz_t, bit_index As mp_bitcnt_t ) As Integer
public: static int mpz_tstbit( mpz_t^ op, mp_bitcnt_t bit_index )
static member mpz_tstbit : op : mpz_t * bit_index : mp_bitcnt_t -> int
Parameters
- op
- Type: Math.Gmp.Nativempz_t
- bit_index
- Type: Math.Gmp.Nativemp_bitcnt_t
Return Value
Type: Int32Test bit bit_index in op and return 0 or 1 accordingly.

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 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);
' Create, initialize, and set the value of rop to 70. Dim rop As 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, 3UI) = 0) ' Release unmanaged memory allocated for rop. gmp_lib.mpz_clear(rop)
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.
