mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
16 lines
428 B
Text
16 lines
428 B
Text
New traits `getBitfieldOffset` and `getBitfieldWidth` for built-in bitfields
|
|
|
|
This completes the introspection capabilities of built-in bitfields. For example:
|
|
|
|
---
|
|
struct S
|
|
{
|
|
int a,b;
|
|
int :2, c:3;
|
|
}
|
|
|
|
static assert(__traits(getBitfieldOffset, S.b) == 0);
|
|
static assert(__traits(getBitfieldOffset, S.c) == 2);
|
|
static assert(__traits(getBitfieldWidth, S.b) == 32);
|
|
static assert(__traits(getBitfieldWidth, S.c) == 3);
|
|
---
|