aboutsummaryrefslogtreecommitdiff
path: root/test/3.cff
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-30 11:21:24 +0200
committerlemon <lsof@mailbox.org>2022-08-30 11:21:24 +0200
commitdeb6b8e1b6fc2543ff27f8d0c75789733374a2c1 (patch)
tree3d618e367bbf4a509e40eab8edc8bd9265b17f52 /test/3.cff
parentdea68bafe81c40adf29e45630cfeceb97b91a630 (diff)
bitfield initializers
Diffstat (limited to 'test/3.cff')
-rw-r--r--test/3.cff10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/3.cff b/test/3.cff
index 7103225..7a92c12 100644
--- a/test/3.cff
+++ b/test/3.cff
@@ -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);
}