diff options
| author | 2022-08-30 11:21:24 +0200 | |
|---|---|---|
| committer | 2022-08-30 11:21:24 +0200 | |
| commit | deb6b8e1b6fc2543ff27f8d0c75789733374a2c1 (patch) | |
| tree | 3d618e367bbf4a509e40eab8edc8bd9265b17f52 /test | |
| parent | dea68bafe81c40adf29e45630cfeceb97b91a630 (diff) | |
bitfield initializers
Diffstat (limited to 'test')
| -rw-r--r-- | test/3.cff | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -1,5 +1,13 @@ import "libc.hff"; +bitfield ColorMaskFlags : u32 { + red 1 bool, + green 1 bool, + blue 1 bool, + alpha 1 bool, + id (8,3), +}; + fn sum(res int, ...) int { let ap va_list = {}; ap->start(); @@ -16,4 +24,6 @@ fn sum(res int, ...) int { extern fn main(argc int, argv **u8) int { printf("= %d\n", sum(1,2,3,42,-1,0)); + let rgb = ColorMaskFlags { .red: #t, .blue: #t, .id: 13}; + printf("0x%X\n", rgb.#raw); } |