mirror of
https://github.com/dlang/dmd.git
synced 2025-04-25 20:50:41 +03:00
add __traits getBitfieldOffset and getBitfieldWidth (#17043)
This commit is contained in:
parent
e17cc3a28f
commit
b70e66033c
5 changed files with 82 additions and 0 deletions
16
changelog/dmd.getBitfieldInfo.dd
Normal file
16
changelog/dmd.getBitfieldInfo.dd
Normal file
|
@ -0,0 +1,16 @@
|
|||
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);
|
||||
---
|
Loading…
Add table
Add a link
Reference in a new issue