Top "Bit-fields" questions

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.

Is it possible to use array of bit fields?

I am curious to know, Is it possible to use array of bit fields? Like: struct st { unsigned int i[5]: 4; };

c++ c arrays struct bit-fields
What does 'unsigned temp:3' in a struct or union mean?

Possible Duplicate: What does this C++ code mean? I'm trying to map a C structure to Java using JNA. I …

c++ c bit-fields colon
Memory layout of struct having bitfields

I have this C struct: (representing an IP datagram) struct ip_dgram { unsigned int ver : 4; unsigned int hlen : 4; unsigned int …

c unix struct ip bit-fields
Bit field vs Bitset

I want to store bits in an array (like structure). So I can follow either of the following two approaches …

c++ bit-fields bitset
How to assign value to a struct with bit-fields?

I have a struct with bit-fields (totally 32 bit width) and I have a 32-bit variable. When I try to assign …

c++ bit-fields
In C#, how to easily map enum flags from one type to another?

Also see the updates at the end of the question... Given the following situation: [Flags] enum SourceEnum { SNone = 0x00, SA = 0…

c# enums mapping bit-fields
c union and bitfields

Can bitfields be used in union?

c bit-fields unions
What is the best way to do Bit Field manipulation in Python?

I'm reading some MPEG Transport Stream protocol over UDP and it has some funky bitfields in it (length 13 for example). …

python udp bits bit-fields
What is the best way to initialize a bitfield struct in C++?

In C++, I have a class which contains an anonymous bitfield struct. I want to initialize it to zero without …

c++ constructor struct initialization bit-fields
How to simulate bit-fields in Delphi records?

I would like to declare a record in Delphi that contains the same layout as it has in C. For …

delphi record bit-fields