ITP 165x Lecture 25: Bitwise Operators
Document Summary
Itp 165: intro to c++ - lecture 25: bitwise operators. Bitwise operators operate on each bit of binary number(s) in a specific way. We will cover 4 different bitwise operators in c++: Bitwise not operates on a single number, whereas and, or, xor operate between two numbers. Bitwise not flips every bit in a single binary number. So something that was previously a 0 will instead be a 1, and viceversa. In a bitwise and, you line up the binary digits of two numbers. Any places that are a 1 in both numbers are a 1 in the result. In a bitwise or, you line up the binary digits of two numbers. Any places that are a 1 in either of the numbers are a 1 in the result. In a bitwise xor (exclusive or), you line up the binary digits of two numbers.