Bit flip only function?

Christ Schlacta aarcane at gmail.com
Sun Jul 20 23:42:51 UTC 2014


You're all trying too hard to map bit strings to integers.  Sometimes a bit
string is just a bit string.  For bitwise negation, obviously, 1111 1111
should negate to 0000 0000, and 10 1010 should negate to 01 0101.  There is
no consideration of repetition to infinity, or sign, or any other
arithmetic numerical properties.  The bit string is simply a bit string.
On Jul 20, 2014 4:12 PM, "Richard Damon" <Richard at damon-family.org> wrote:

> On 7/20/14, 12:22 PM, Viktor Kletzhändler wrote:
>
>> 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?
>>
>> --vk
>>
>>  I suspect that what you are missing is that the binary value 1111 1111
> if it really means 255 decimal is REALLY the bit pattern
> +0 1111 1111 (to store the sign bit), and thus the complement would be -1
> 0000 0000 (where the sign is used to indicate that the leading bit is
> replicated to infinity (but can be ignored for value).
>
> --
> Richard Damon
>
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-discuss
>


More information about the gmp-discuss mailing list