Bit flip only function?
vkletzhaendler at swissonline.ch
Sun Jul 20 16:22:29 UTC 2014
Thanks for the reply.
mpz_com seems to do more than flipping.
For example, for a base-2 number
mpz_com ( 1111 1111 ) returns ( -1 0000 0000 )
whereas I would like _dcom ( 1111 1111 ) returns ( 0 ).
Am I missing something?
Am 20.07.2014 um 16:46 schrieb Pedro Gimeno:
> Viktor Kletzhändler wrote, On 2014-07-20 12:47:
>> The mpz_ logical and bit manipulation functions all seem to work on two's complement representations (as indicated in the manual). This is also true for the respective mpn_ functions, as far as I can see.
>> Is there an efficient "bit flip only" function (equivalent to the ~ operator)?
> Yes. That operator performs the one's complement of the operand. In GMP
> that function is performed by mpz_com; see manual on usage.
More information about the gmp-discuss