Bit flip only function?
Torbjörn Granlund
tg at gmplib.org
Sun Jul 20 17:23:15 UTC 2014
Viktor Kletzhändler <vkletzhaendler at swissonline.ch> writes:
mpz_com seems to do more than flipping.
We might not understand what "flipping" might mean. mpz_com
computes the one's complement.
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?
So "flipping" means f(11111111) = 0, i.e., 8 consecutive ones should map
to 0. I assume the function "flipping" should be a bijection, so no
other value x should have f(x) = 0. Perhaps f(f(x)) = x should hold for
any value x?
Then, what should f(1), f(11), f(111), ... yield? What's so special
about 11111111?
--
Torbjörn
Please encrypt, key id 0xC8601622
More information about the gmp-discuss
mailing list