Thread: operators
View Single Post
  #14  
Old 11-05-2006, 10:49 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Uhhhh xor does not act like you think it does.

PHP Code:
var_a 1// or in binary, 000......0001
var_b 2// or in binary, 000......0010
var_c var_a xor var_b// only where one of the bits from either variable's binary values is 1, so we get 000.......0011, or 3. 
And for the others:
<<
PHP Code:
var_a 3// or in binary, 000......0011
var_b 2;
var_c var_a << var_b// shifting the binary left twice to yield 000.......1100, or 12. 
>>
PHP Code:
var_a 6// or in binary, 000......0110
var_b 2;
var_c var_a >> var_b// shifting the binary right twice to yield 000.......0001, or 1. 
~
PHP Code:
var_a 0// or in binary, 000.....0000
var_b = ~var_a// yields binary 111.....1111, or -1. 
This is not necessarily true for unsigned long integers, but I don't think Graal deals with them, so.... yeah. But if we did, ~0 would be 4294967295.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 11-05-2006 at 11:10 PM..
Reply With Quote