Re: Had an interview



Spehro Pefhany schrieb:

x^=3; // explain wtf this is doing right here Best regards,

Toggeling the lowest two bits...

It's a WTF not to understand that this toggles just the two lowest bits.

Ok - I agree toggeling two bits can mean anything. It always depends on the context.



The magic happends if you deeply understanand that an innocent xor is half of an addition (the carry/overflow part) and half of an multiplication (in galois-space at least) at the same time, along with the consequences that this implies.

XOR rocks! I've optimized quite a bit of arithmetic with it, and it wasn't always obvious. I sat there more than once in the middle of the night, starred at a truth-table only to find out that x = A ^ (B+1) or something similar was the fastest way to express an arithmetic expression.

Love it! Excellent! Binary arithmetic can be so beautiful.

Nils

.