Tag Archives: bit-twiddling

Swapping Variables

Many algorithms, including the world-famous Euclidean, require to swap the values of two variables. So you probably know the following principle. int x = 8; int y = 123; int tmp = x; x = y; y = tmp; However, … Continue reading

Posted in Bit-Twiddling, Information Theory, Uncategorized | Tagged , , , , | Comments Off on Swapping Variables

The X-Factor (OR The Power of XOR)

Once upon a time, a girl (non-computer scientist) had bought two pieces of cake for coffee. She asked her nerdy boy-friend: ‘Do you want this one or that one?’ He said ‘Thanks!’ and he quickly moved both pieces onto his … Continue reading

Posted in Bit-Twiddling, Uncategorized | Tagged , , , | Leave a comment

Masking

In this posting I’m going to explain a bit-twiddling technique called masking. It is used to extract (and alter) specific bits in a word of bits, for example a byte. You might be familiar with IP subnet masks in network … Continue reading

Posted in Bit-Twiddling, Uncategorized | Tagged , , , , | Comments Off on Masking