Skip to content

Commit 26ae6e0

Browse files
committed
bitset: rename BitSet to Bitset
1 parent e9eba76 commit 26ae6e0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

bitset.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package bitset
33
const word = uint64(64)
44
const logword = uint(6)
55

6-
type BitSet struct {
6+
type Bitset struct {
77
length uint64
88
bits []uint64
99
}
@@ -12,9 +12,9 @@ func getSize(length uint64) uint64 {
1212
return uint64((length + word - 1) / word)
1313
}
1414

15-
func New(length uint64) *BitSet {
15+
func New(length uint64) *Bitset {
1616
size := getSize(length)
17-
return &BitSet{
17+
return &Bitset{
1818
length,
1919
make([]uint64, size),
2020
}
@@ -26,31 +26,31 @@ func getIndex(pos uint64) (q uint64, r uint) {
2626
return
2727
}
2828

29-
func (b *BitSet) Length() uint64 {
29+
func (b *Bitset) Length() uint64 {
3030
return b.length
3131
}
3232

33-
func (b *BitSet) Get(pos uint64) bool {
33+
func (b *Bitset) Get(pos uint64) bool {
3434
q, r := getIndex(pos)
3535
bit := (b.bits[q] >> r) & 1
3636
return bit != 0
3737
}
3838

39-
func (b *BitSet) Set(pos uint64) bool {
39+
func (b *Bitset) Set(pos uint64) bool {
4040
current := b.Get(pos)
4141
q, r := getIndex(pos)
4242
b.bits[q] |= (1 << r)
4343
return current
4444
}
4545

46-
func (b *BitSet) Clear(pos uint64) bool {
46+
func (b *Bitset) Clear(pos uint64) bool {
4747
current := b.Get(pos)
4848
q, r := getIndex(pos)
4949
b.bits[q] &= ^(1 << r)
5050
return current
5151
}
5252

53-
func (b *BitSet) Flip(pos uint64) bool {
53+
func (b *Bitset) Flip(pos uint64) bool {
5454
current := b.Get(pos)
5555
q, r := getIndex(pos)
5656
b.bits[q] ^= (1 << r)

0 commit comments

Comments
 (0)