Advanced Uses of Bitwise Operations in Developer Help
|
|
I've seen Popisfizzy use bitwise operations a lot and I only understood like 10% of the code he posted. So far, I got the hang of & and |, but now I want to know more about >>, <<, ^, and others that I missed out. I want to know when the operators that I specified would be very useful.
|
http://www.byond.com/members/ DreamMakers?command=view_post&post=39760
Ex:
101 << 2 would return "10100"
10100 >> 2 = 101
You can think ^ as a toggle operator:
6 (1010) ^ 2 (10) = 4 (1000) ^ 2 (10) = 6 (1010) ^ 4 (1000) = 2 (10) ... etc
... Either ways, read the article, it explains a bit more clearly then what I tried to explain >_>