-- get, set, toggle, or clear 64 flags
Flags is a simple package to set and get 64 bit flags. If you're familiar with basic bit twiddling you won't need it, but if you're like me and need to look up these operations every time because you're not using them very often, this package might be a useful shortcut.
type Bits uint64
Bits represents 64 bits. The constants Flag0 .. Flag63 can be used to address the flags in this bitfield.
Set(b, flag Bits) Bits
Set the flag in the given bitfield b
, return the new bitfield.
Clear(b, flag Bits) Bits
Clear the flag in the given bitfield b
, return the new bitfield.
Toggle(b, flag Bits) Bits
Toggle the flag in the given bitfield b
, return the new bitfield.
Has(b, flag Bits) bool
Return true if the flag in bitfield b
is set, false otherwise.