From deb6b8e1b6fc2543ff27f8d0c75789733374a2c1 Mon Sep 17 00:00:00 2001 From: lemon Date: Tue, 30 Aug 2022 11:21:24 +0200 Subject: bitfield initializers --- test/3.cff | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') 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); } -- cgit v1.2.3