Skip to content

Commit c7e48fc

Browse files
author
jxguan
authored
Fix the bug where the capacity is incorrectly calculated.
The capacity should be s timed with the number of blocks, instead of added with. Also, the block numbers are zero-based, so a "+1" is needed to get to the correct number.
1 parent 59788d5 commit c7e48fc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bitarray/sparse_bitarray.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func (sba *sparseBitArray) Capacity() uint64 {
178178
return 0
179179
}
180180

181-
return sba.indices[len(sba.indices)-1] + s
181+
return (sba.indices[len(sba.indices)-1] + 1) * s
182182
}
183183

184184
// Equals returns a bool indicating if the provided bit array

0 commit comments

Comments
 (0)