gmp_libmpz_ior Method |
Namespace: Math.Gmp.Native
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 op1 to 63. mpz_t op1 = new mpz_t(); gmp_lib.mpz_init_set_ui(op1, 63U); // Create, initialize, and set the value of op2 to 70. mpz_t op2 = new mpz_t(); gmp_lib.mpz_init_set_ui(op2, 70U); // Create, initialize, and set the value of rop to 0. mpz_t rop = new mpz_t(); gmp_lib.mpz_init(rop); // Set rop to the bitwise inclusive or of op1 and op2. gmp_lib.mpz_ior(rop, op1, op2); // Assert that rop is 127. Assert.IsTrue(gmp_lib.mpz_get_si(rop) == 127); // Release unmanaged memory allocated for rop, op1, and op2. gmp_lib.mpz_clears(rop, op1, op2, null);