D - Way to express bitfields?
- Steve Adams (11/11) Mar 19 2003 In D, is there a way to express
- Burton Radons (2/15) Mar 19 2003 No.
- DDevil (19/32) Mar 19 2003 Is that written correctly? Why would you have a union of bitfields? Th...
In D, is there a way to express typedef struct { struct { union { unsigned long F1 : 25; unsigned long F2 : 7; }; unsigned long all; }; } Bitfields; and still have it fit in a single long?
Mar 19 2003
Steve Adams wrote:In D, is there a way to express typedef struct { struct { union { unsigned long F1 : 25; unsigned long F2 : 7; }; unsigned long all; }; } Bitfields; and still have it fit in a single long?No.
Mar 19 2003
On Wed, 19 Mar 2003 10:27:00 -0500, Steve Adams wrote:In D, is there a way to express typedef struct { struct { union { unsigned long F1 : 25; unsigned long F2 : 7; }; unsigned long all; }; } Bitfields; and still have it fit in a single long?Is that written correctly? Why would you have a union of bitfields? The way it's currently written would take more than 4 bytes in C/C++ also. Do you mean: typedef struct { union { struct { unsigned long F1 : 25; unsigned long F2 : 7; }; unsigned long all; }; } Bitfields; ? That only takes the space of one long. -- // DDevil
Mar 19 2003