Bit Masking (Setting, Clearing, and Inverting) Using Boolean Logical Functions

The boolean functions NOT, AND, OR, and XOR describe different ways that logical expressions can be used to manipulate true and false values to represent both simple and complex decisions or conditions. However, these functions can also be used in a more mundane manner to allow the direct manipulation of binary data. This use of boolean logic is very important in a number of different applications in networking.

You should recall that when you give a bit a value you set the bit, and when you give it a value of 0, you reset or clear it. In some situations bits are handled individually and are set or cleared simply by assigning a 0 or 1 value to each bit. However, it is ...

Get TCP/IP Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.