summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library/scala/collection/BitSetLike.scala13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/library/scala/collection/BitSetLike.scala b/src/library/scala/collection/BitSetLike.scala
index 7d9f48f299..e4f9fd436a 100644
--- a/src/library/scala/collection/BitSetLike.scala
+++ b/src/library/scala/collection/BitSetLike.scala
@@ -65,7 +65,7 @@ trait BitSetLike[+This <: BitSetLike[This] with SortedSet[Int]] extends SortedSe
var i = nwords
while (i > 0) {
i -= 1
- s += popCount(word(i))
+ s += java.lang.Long.bitCount(word(i))
}
s
}
@@ -221,15 +221,4 @@ object BitSetLike {
else assert(w == 0L)
newelems
}
-
- private val pc1: Array[Int] = {
- def countBits(x: Int): Int = if (x == 0) 0 else x % 2 + countBits(x >>> 1)
- Array.tabulate(256)(countBits _)
- }
-
- private def popCount(w: Long): Int = {
- def pc2(w: Int) = if (w == 0) 0 else pc1(w & 0xff) + pc1(w >>> 8)
- def pc4(w: Int) = if (w == 0) 0 else pc2(w & 0xffff) + pc2(w >>> 16)
- if (w == 0L) 0 else pc4(w.toInt) + pc4((w >>> 32).toInt)
- }
}