|
Posted by "Chris Boget" on 09/26/05 20:02
>I tested; I don't want to waste peoples time. Rewriting the question:
> this outputs:
> c = 32
> d = 0
> The question is why?
First row is the bit's number and the second row is the bit's value:
#8 | #7 | #6 | #5 | #4 | #3 | #2 | #1
---------------------------------------
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1
So your variable $a, which has a value of 4 starts out in the bit position
of #3 with that bit turned on.. Shift it left 3 (value of $b) spaces and
you
end up with bit #6 getting turned on giving you a value of 32, which is what
$c is echoing out.
Shifting to the right 3 spaces from the same starting position nets you 0
with
all the bits turned off. At least, I'm pretty sure that's right.
thnx,
Chris
Navigation:
[Reply to this message]
|