}
}
-byte_dump :: (ptr: rawptr, byte_count: u32) {
+byte_dump :: (ptr: rawptr, byte_count: u32, bytes_per_line := 8) {
temp: [3] u8;
u8_ptr := cast(^u8) ptr;
runtime.__output_string(.{ ~~temp, 3 });
- if i % 8 == 7 do runtime.__output_string("\n");
+ if i % bytes_per_line == (bytes_per_line - 1) do runtime.__output_string("\n");
}
println(cast(i32) FlaggedEnum.Value3);
println(cast(i32) FlaggedEnum.Value4);
print("\n");
+
+ {
+ // As a convenience, if the type of the enum can be determined from context,
+ // you can leave out the enum name from the lookup and just use a unary '.'.
+ // For example,
+ //
+
+ val := SimpleEnum.Value2;
+
+ // Here .Value2 can be resolved from the context of "val".
+ if val == .Value2 {
+ println("val is Value2");
+ }
+ }
}
{
// You can 'use' struct members that are structures.
- // This is already explained in the struct example.
+ // This is already explained in the struct example.
}
}