Skip to content

Commit 3709fac

Browse files
committed
save
1 parent 503c9e9 commit 3709fac

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

db/recsplit/eliasfano32/elias_fano.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@ func (ef *EliasFano) deriveFields() int {
123123
// Build construct Elias Fano index for a given sequences
124124
func (ef *EliasFano) Build() {
125125
for i, c, lastSuperQ := uint64(0), uint64(0), uint64(0); i < uint64(ef.wordsUpperBits); i++ {
126-
for word := ef.upperBits[i]; word != 0; word &= word - 1 { // iterate over set bits only; word &= word-1 clears the lowest set bit
127-
b := uint64(bits.TrailingZeros64(word))
126+
for b := uint64(0); b < 64; b++ {
127+
if ef.upperBits[i]&(uint64(1)<<b) == 0 {
128+
continue
129+
}
128130
if (c & superQMask) == 0 {
129131
// When c is multiple of 2^14 (4096)
130132
lastSuperQ = i*64 + b

0 commit comments

Comments
 (0)