I know my bits Richard, did way too much assembly coding when I was a kiddy to ever forget. But complex calculations? Hmm... where is the complexity in the following few lines?

For example, let's reset bit 4 (16)

Code:
$a = 89
if ($a & 16)
$a = $a ^ 16
endif
? $a



Looks very neat and simple to me. But then again, nothing wrong with the ~, as long as it works as expected and when it is nicely documented.
xor is among the fastest (assembly) instructions around

Besides, the XOR is one of the fastest assembly instructions around, it's well known for example that it's quicker to xor a register to 0 then to set it to 0.


Edited by iffy (2005-09-10 12:36 AM)