More on Using Bitwise Operations
Learn how we can use bitwise operations to calculate bitmasks and do optimizations for arithmetic calculations.
We'll cover the following...
Computing bitmasks
Here is another example of using bitwise operations. We need them for computing bitmasks, which use OR or AND operators to encode or decode values respectively. We’re already familiar with file permission masks in the Unix environment. Let’s suppose that a file has the permissions “-rw-r–r–”. It looks like this in binary:
0000 0110 0100 0100
Let’s suppose that we want to check if the file owner can execute it. We can do that by calculating the bitwise AND for the permission mask and the ...
Access this course and 1400+ top-rated courses and projects.