2
Answers

Bits in Enum flags

Ask a question
S

S

12y
1.5k
1

Hi

Just need assistance in clarifying the below please

I'm aware a bit has a single binary value of either 0 or 1 and 8 bits make a Byte etc etc. but how does this work in relation to Bits in an Enum flag.

For example:-

The values 0x0, 0x1, 0x2, 0x4 indicate powers of two. In computer bits, powers of two contain one bit set.

Quote "Where powers of two contain one bit set" does this mean it could be either a 0 or 1 in binary?

i.e. 0x0 is 0, 0x1 is 01, 0x2 is 11 and 0x4 is 1111?

Thanks


Answers (2)