Bitwise Operators
Bitwise operations are those that work on individual bits, such as shifting a bit to the left, and for this, we have a suite of specialized operators known as bitwise operators. We're not going to go into too much detail here—a full discussion on bitwise operators is for another day. However, we will take a quick look at what bitwise operators we have available to us, along with some quick examples of their use. This will give you some preliminary understanding so that when you do come across them later, they'll be familiar.
Note
Remember, a bit (that is, a binary digit) is the most fundamental unit of data in a computer. With two possible values, either 1 or 0, all data is stored in bits. The smallest addressable unit of data on a machine is a byte, which is made up of 8 bits, so bitwise operations allow us to manipulate bits individually.
In the following examples, we're going to be working with bitsets. This is a simple...