bits¶
This module allows you to succinctly define pairs of getters and setters for particular bits on distinct integer types.
Example:
type
Color* = distinct uint16
bitdef Color, 0..4, r, int
bitdef Color, 5..9, g, int
bitdef Color, 10..14, b, int
- type FieldFlag = enum¶
ReadOnly
WriteOnly
Private
- template bitdef(bitfieldType: typedesc, bits: Slice[SomeInteger], fieldIdent: untyped, fieldType: typedesc, flags: static set[FieldFlag] = {})¶
- template bitdef(bitfieldType: typedesc, bit: SomeInteger, fieldIdent: untyped, fieldType: typedesc, flags: static set[FieldFlag] = {})¶