diff options
| author | 2022-08-26 22:08:52 +0200 | |
|---|---|---|
| committer | 2022-08-26 22:11:30 +0200 | |
| commit | 4a7d610bb9a441f6fb7f88caaa803c1c85e4fcfd (patch) | |
| tree | 3ac01c9be375f30efd09f0a670da74f886ad44ca /test | |
| parent | 475125eaba2852f88a4ee8d9be64c8b4964df3a9 (diff) | |
bitfields
Diffstat (limited to 'test')
| -rw-r--r-- | test/2.cff | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/2.cff b/test/2.cff new file mode 100644 index 0000000..8b512ea --- /dev/null +++ b/test/2.cff @@ -0,0 +1,17 @@ +import "libc.hff"; + +bitfield Foo : uint { + tag 3, + flag (3, 1) bool, + num 10 signed, +} + +extern fn main() int { + let foo Foo = {}; + printf("0x%X: %d, %d, %d\n", foo.#raw, foo.tag, foo.flag, foo.num); + foo.tag = 3; + foo.#raw += 1; + foo.flag = #t; + foo.num = -2; + printf("0x%X: %d, %d, %d\n", foo.#raw, foo.tag, foo.flag, foo.num); +} |