Skip to content
Snippets Groups Projects
Commit a81fcb74 authored by Reynold Xin's avatar Reynold Xin
Browse files

Merge pull request #68 from jegonzal/BitSetSetUntilBug

Addressing bug in BitSet.setUntil(ind)
parents 143c01db f0ef75c7
No related branches found
No related tags found
No related merge requests found
......@@ -41,9 +41,11 @@ class BitSet(numBits: Int) {
val wordIndex = bitIndex >> 6 // divide by 64
var i = 0
while(i < wordIndex) { words(i) = -1; i += 1 }
// Set the remaining bits
val mask = ~(-1L << (bitIndex & 0x3f))
words(wordIndex) |= mask
if(wordIndex < words.size) {
// Set the remaining bits (note that the mask could still be zero)
val mask = ~(-1L << (bitIndex & 0x3f))
words(wordIndex) |= mask
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment