Tag Archives: bitwise operators

Bitwise Operators – Free Guide

I have an exciting new eGuide available. Most of this info is available in various places on my site, but I’ve collated it all together in one document, and updated it, so it’s easier for you to use. What does it cover? It’s a no-jargon guide to the four bitwise operators in C (AND, OR, […]

Bitwise RGBA Values

Let’s take a look at bit shifting in practice. Say we have a variable called colour, that contains an RGBA value. If you have never had any experience with graphics, all you need to know is that the colours you see on your screen may be represented as a combination of four different variables – […]

Bit Shifting

The left and right shift operators are the last two bitwise operators for us to look at. In C (and C++), << and >> are used to shift bits around inside bytes. Not just in any random fashion – these operators move all the bits either to the left or to the right, exactly as […]

Bitwise NOT

Well, we’re now onto the final of the four bitwise operators – bitwise NOT – probably the most simple of the four to understand. Bitwise NOT is represented by the tilde symbol, ~, and only takes one operand. Can I see an example? ~125 = 130 What is this actually doing? Bitwise NOT essentially flips […]