aboutsummaryrefslogtreecommitdiff
path: root/test/2.cff
diff options
context:
space:
mode:
Diffstat (limited to 'test/2.cff')
-rw-r--r--test/2.cff17
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);
+}