Skip to content

arl/bitstring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go.dev reference Test Actions Status Go Report Card codecov

bitstring

Go bitstring library

Package bitstring implements a fixed length bit string type and bit manipulation functions.

  • Get/Set/Clear/Flip a single bit: Bit|SetBit|ClearBit|FlipBit
  • Set/Clear/Flip a range of bits: SetRange|ClearRange|FlipRange
  • Compare 2 bit strings: Equals or EqualsRange
  • 8/16/32/64/N signed/unsigned to/from conversions:
    • Uint8|Uint16|Uint32|Uint64|Uintn
    • SetUint8|SetUint16|SetUint32|SetUint64|SetUintn
  • Count ones/zeroes: ZeroesCount|OnesCount
  • Gray code conversion methods: Gray8|Gray16|Gray32|Gray64|Grayn
  • Convert to/from big.Int: BigInt | NewFromBig
  • Copy/Clone methods: Copy|Clone|CopyRange
  • Trailing/LeadingZeroes : TrailingZeroes|LeadingZeroes

Debug version

By default, bit offsets arguments to bitstring methods are not checked. This allows not to pay the performance penalty of always checking offsets, in environments where they are constants or always known beforehand.

You can enable runtime checks by passing the bitstring_debug build tag to go when building the bitstring package.

TODO: