Re: Had an interview
- From: Nils <n.pipenbrinck@xxxxxxxxx>
- Date: Fri, 02 May 2008 22:17:44 +0200
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
.
- References:
- Re: Had an interview
- From: Andrey Tarasevich
- Re: Had an interview
- From: Spehro Pefhany
- Re: Had an interview
- Prev by Date: Re: A few novice questions
- Next by Date: Re: migrating from 8051 to AVR!
- Previous by thread: Re: Had an interview
- Next by thread: Re: Had an interview
- Index(es):