0
votes
3answers
232 views

What does “ (int) value & 0x1, (int) value & 0x2, (int) value & 0x4, (int) value & 0x8 means”

The "value" ranges from 0 to 15 (it's possible values). When will those 4 "if"condition be met? If my (int)value = 2 does this mean 0010? if ((int)value & 0x1) { ...
2
votes
1answer
291 views

Clearing the lowest set bit of a number

I can see in this tutorial on bit manipulation, under the heading "Extracting every last bit", that - Suppose we wish to find the lowest set bit of x (which is known to be non-zero). If we ...
21
votes
4answers
6k views

Using scoped enums for bit flags in C++

An enum X : int (C#) or enum class X : int (C++11) is a type that has a hidden inner field of int that can hold any value. In addition, a number of predefined constants of X are defined on the enum. ...
0
votes
2answers
286 views

What kind of specific projects can I do to master bitwise operations in C++? Also is there a canonical book? [closed]

I don't use C++ or bitwise operations at my current job but I'm thinking of applying to companies where it is a requirement to be fluent with them (on their tests anyway). So my question is: Can ...