Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/15084#discussion_r78716354
--- Diff: core/src/main/scala/org/apache/spark/util/collection/BitSet.scala
---
@@ -58,6 +58,20 @@ class BitSet(numBits: Int) extends Serializable {
}
/**
+ * Clear all the bits up to a given index
+ */
+ def clearUntil(bitIndex: Int) {
+ val wordIndex = bitIndex >> 6 // divide by 64
+ var i = 0
+ while(i < wordIndex) { words(i) = 0; i += 1 }
+ if(wordIndex < words.length) {
+ // Set the remaining bits (note that the mask could still be zero)
+ val mask = ~(-1L << (bitIndex & 0x3f))
+ words(wordIndex) &= ~mask
--- End diff --
The mask is negated twice; that can be avoided.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]