Skip to content
/ flags Public

Go convenience package to get, set, toggle, or clear 64 flags in a bitfield

License

Notifications You must be signed in to change notification settings

rasteric/flags

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flags

-- get, set, toggle, or clear 64 flags

GoDoc Go Report Card License

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.

API

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.

About

Go convenience package to get, set, toggle, or clear 64 flags in a bitfield

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages