GMP Native Interface for .NET
gmp_libmpz_com Method |
Set rop to the one’s complement of op.
Namespace: Math.Gmp.Native
Assembly: Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)

public static void mpz_com( mpz_t rop, mpz_t op )
Public Shared Sub mpz_com ( rop As mpz_t, op As mpz_t )
public: static void mpz_com( mpz_t^ rop, mpz_t^ op )
static member mpz_com : rop : mpz_t * op : mpz_t -> unit
Parameters
- rop
- Type: Math.Gmp.Nativempz_t
The result integer. - op
- Type: Math.Gmp.Nativempz_t
The operand integer.

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 63. mpz_t op = new mpz_t(); gmp_lib.mpz_init_set_ui(op, 63U); // 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 one's complement of op. gmp_lib.mpz_com(rop, op); // Assert that rop is -64. Assert.IsTrue(gmp_lib.mpz_get_si(rop) == -64); // Release unmanaged memory allocated for rop and op. gmp_lib.mpz_clears(rop, op, null);
' Create, initialize, and set the value of op to 63. Dim op As New mpz_t() gmp_lib.mpz_init_set_ui(op, 63UI) ' Create, initialize, and set the value of rop to 0. Dim rop As New mpz_t() gmp_lib.mpz_init(rop) ' Set rop to the one's complement of op. gmp_lib.mpz_com(rop, op) ' Assert that rop is -64. Assert.IsTrue(gmp_lib.mpz_get_si(rop) = -64) ' Release unmanaged memory allocated for rop and op. gmp_lib.mpz_clears(rop, op, Nothing)
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.
