(squash this) address PR comments + fix bug in equality check

This commit is contained in:
ValarDragon
2018-08-07 10:44:38 -05:00
parent 6dbbdb9438
commit 67b6d51ff4
5 changed files with 27 additions and 19 deletions
+3 -3
View File
@@ -69,12 +69,12 @@ func (bA *CompactBitArray) SetIndex(i int, v bool) bool {
return true
}
// trueIndex returns the location of the given index, among the
// NumOfTrueBitsBefore returns the location of the given index, among the
// values in the bit array that are set to true.
// e.g. if bA = _XX_X_X, trueIndex(4) = 2, since
// e.g. if bA = _XX_X_X, NumOfTrueBitsBefore(4) = 2, since
// the value at index 4 of the bit array is the third
// value that is true. (And it is 0-indexed)
func (bA *CompactBitArray) trueIndex(index int) int {
func (bA *CompactBitArray) NumOfTrueBitsBefore(index int) int {
numTrueValues := 0
for i := 0; i < index; i++ {
if bA.GetIndex(i) {