I have a Flags
enum and want to assert that a given instance of it, is one of the primitive values, i.e. it has exactly one '1' in its binary representation, i.e. it's a power of two.
What's the best way to check this?
(I suppose "best" isn't necessarily well-defined, so ...)
- What's the fastest way to check this?
- What's the most semantically clear way to check this?
- How do I check this, whilst writing the least code?