diff options
| author | gingerBill <bill@gingerbill.org> | 2018-08-17 15:11:41 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-08-17 15:11:41 +0100 |
| commit | b216e44870b1883cf3fb71994eb94f642fea43a1 (patch) | |
| tree | 35deeadee9a5d2c5c0d7fe74d4d874385ce68897 /examples | |
| parent | 7d39b26cf4537943ecd668777d830dfa8579edbe (diff) | |
Add underlying type for `bit_set`
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/demo/demo.odin | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/demo/demo.odin b/examples/demo/demo.odin index 3ac7a0d1f..9a592bc43 100644 --- a/examples/demo/demo.odin +++ b/examples/demo/demo.odin @@ -744,12 +744,15 @@ bit_set_type :: proc() { } { x: bit_set['A'..'Z']; - y: bit_set[0..8]; + assert(size_of(x) == size_of(u32)); + y: bit_set[0..8; u16]; fmt.println(typeid_of(type_of(x))); // bit_set[A..Z] fmt.println(typeid_of(type_of(y))); // bit_set[0..8] - x |= {'F'}; + incl(&x, 'F'); assert('F' in x); + excl(&x, 'F'); + assert(!('F' in x)); y |= {1, 4, 2}; assert(2 in y); @@ -757,7 +760,7 @@ bit_set_type :: proc() { } main :: proc() { - when true { + when false { general_stuff(); union_type(); parametric_polymorphism(); @@ -769,6 +772,6 @@ main :: proc() { complete_switch(); cstring_example(); deprecated_attribute(); - bit_set_type(); } + bit_set_type(); } |