Questions tagged [bit-fields]

A bit field is used to compactly store multiple logical values as a short series of bits where each of the single bits can be addressed separately.

A bit field is used to represent and store a set of known width and logically grouped set of values. These fields can then be addressed individually in the code. A common use of such a construct is flags.

In language such as C and C++, bit fields can also be used to abstract and interop with specific hardware.

857 questions
-6
votes
4 answers

What are flags and bitfields?

Can someone explain to me what flags and bitfields are. They seems to be related to each other, or mabye i got the wrong idea. I kinda grasp bits and pieces of what they do and are but I would like to get them fully explain and I can't really find…
-10
votes
4 answers

MSVC 1 bit enum type equals -1 and equality test fails

I have defined a bitfield of enum types to match a set of bits in an embedded system. I'm trying to write a test harness in MSVC for the code, but comparing what should be equal values fails. The definition looks like this: typedef enum { SERIAL,…
user11567957
1 2 3
57
58