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 […]

Today we’ll look at the third out of four bitwise operators – bitwise XOR. Bitwise XOR is represented by the symbol ^ and is an exclusive OR operation. Can I see an example? 130 ^ 10 = 136 What is this actually doing? Bitwise XOR compares each bit setting and if either one is set, […]

Following on from last week’s look at the bitwise AND operator, this week I’m going to look at bitwise OR and provide an example of how you can use it. Bitwise OR is represented by the | symbol. Can I see an example? 130 | 10 = 138 What is this actually doing? Bitwise OR […]

I’m going to spend the next few weeks taking a look at the bitwise operators (AND, NOT, OR, XOR), and how they are used in C/C++. How often you are faced with problems that use these operators depends on the field you are working in, and the coding preferences of the people that have gone […]