|
Posted by Jerry Stuckle on 09/28/13 11:37
Pedro Graca wrote:
> Pedro Graca wrote:
>
>>yawnmoth wrote:
>>
>>>Why should >> even be concerned with whether or not integers are signed?
>>
>>~$ php -r 'echo -8 >> 2, "\n";'
>
>
> I forgot the rest of the post ...
>
> Let's say -8 in binary is (ignore the spaces)
> MSB == 10000000 00000000 00000000 00001000 == LSB
>
> if you shift this right without concern for the sign, you get
> MSB == 00100000 00000000 00000000 00000010 == LSB
>
> which is 536870914
>
>
> Do you think -8 >> 2 (-8 divided by 4) should equal 536870914? :)
>
But -8 binary is:
11111111 11111111 11111111 11111000
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|