Archive

Posts Tagged ‘bitwise’

Bitwise operations

September 13th, 2009 No comments

While you don’t see them every day, bitwise operations are important. Everything at the hardware level is represented in binary (base 2, 1 and 0). Bitwise operations allow programmers to operate directly on the bits used by variables. This is very useful with enums, since you can have one variable be multiple values.

To understand how one enum variable can be multiple values, you need to understand the bitwise AND and OR operations.

An OR operation compares two sets of bits. If either bit is 1, the result is 1, else, result is 0. In the below example, set 1 is the value of enum option 1, and set 2 is the value of enum option 2.
Read more…

Categories: Uncategorized Tags: ,