In article <(EMail Removed)>,
Lax <(EMail Removed)> wrote:
>Why is the "x&(x1)" trick for removing the least significant set bit
>from an integer only valid on 2's complement systems?
Orders of Rear Admiral Grace Hopper.
Consider signedmagnitude and the number 2. 1 for the sign, a bunch
of binary 0s, then binary 10 at the end. x1 is 3, which is
1 for the sign, a bunch of binary 0s, then binary 11 at the end.
Bitwise and the two together and you get 1 for the sign, a bunch of
binary 0s, then binary 10 at the end. Which is the representation of 2
which is the number you started with, so the technique does not work
for signedmagnitude.
With this example in mind, you should easily be able to determine
whether the technique works for 1's complement systems.

"After all, what problems has intellectualism ever solved?"
 Robert Gilman
