Determining combination of bits
Scott David Daniels
Scott.Daniels at Acm.Org
Tue Nov 9 22:47:46 EST 2004
Dennis Lee Bieber wrote:
> On Mon, 08 Nov 2004 15:33:01 -0800, Scott David Daniels
> <Scott.Daniels at Acm.Org> declaimed the following in comp.lang.python:
>>(OCA) and increment (INA)". Note that a ones complement turns all of
>>the least significant zeros to ones, and the least significant one to
>>a zero. When you increment that the carry propagates back to the 0 for
> Ones complement turns ALL 0 bits to 1, and ALL 1 bits to 0.
Right. In particular, all of the lowest order zeroes turn to 1s,
the one directly before them turns to zero. Those bits are the only
bits where I care what the value is, all others are simply inverted
(and it doesn't matter what values they have).
> 00000000
> 1C 11111111 ones complement has a "negative zero"
> +1 00000000 twos complement "overflows" back to single zero
Correct, and this isoloates the least significant one bit for this value
as well (inasmuch as it doesn't exist).
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list