mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00
16 lines
402 B
Text
16 lines
402 B
Text
Add __traits getBitfieldOffset and getBitfieldWidth
|
|
|
|
This completes the introspection capabilities of builtin 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);
|
|
---
|