package peer

const bitSetSize = 512 // Multiple of 64.

type bitSet [bitSetSize / 64]uint64

func (bs *bitSet) Set(i int) {
	bs[i/64] |= 1 << (i % 64)
}

func (bs *bitSet) Clear(i int) {
	bs[i/64] &= ^(1 << (i % 64))
}

func (bs *bitSet) ClearAll() {
	clear(bs[:])
}

func (bs *bitSet) Get(i int) bool {
	return bs[i/64]&(1<<(i%64)) != 0
}
