Fix NSet.SetBits in GetDifference

This commit is contained in:
bloeys
2024-09-09 07:55:06 +04:00
parent 17b8c38162
commit ab047eb986
2 changed files with 7 additions and 1 deletions

View File

@ -257,7 +257,13 @@ func (n *NSet[T]) GetDifference(otherSet *NSet[T]) *NSet[T] {
}
if b1.StorageUnitCount > b2.StorageUnitCount {
copy(newB.Data[b2.StorageUnitCount:], b1.Data[b2.StorageUnitCount:])
for j := uint32(b2.StorageUnitCount); j < newB.StorageUnitCount; j++ {
storage := newB.Data[j]
outSet.SetBits += uint64(bits.OnesCount64(uint64(storage)))
}
}
}