File: bitfield.go

package info (click to toggle)
golang-github-offchainlabs-go-bitfield 0.0~git20250408.ad7364d-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 376 kB
  • sloc: makefile: 2
file content (17 lines) | stat: -rw-r--r-- 571 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package bitfield

// Bitfield is the abstraction implemented by Bitlist or BitvectorN.
type Bitfield interface {
	// BitAt returns true if the bit at the given index is 1.
	BitAt(idx uint64) bool
	// SetBitAt sets the bit at the given index to val.
	SetBitAt(idx uint64, val bool)
	// Len returns the length of the bitfield.
	Len() uint64
	// Count returns the number of 1s in the bitfield.
	Count() uint64
	// Bytes returns the bytes value of the bitfield, without the length bit.
	Bytes() []byte
	// BitIndices returns the indices which have a 1.
	BitIndices() []int
}