summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-11-04 14:12:11 +1000
committerJason Zaugg <jzaugg@gmail.com>2014-11-04 14:12:11 +1000
commitd61d007d4852032fcfd339ab2c904a4de6836c4d (patch)
treecf696021da8e421cdb5dd8014228d237a213891d /src/library
parentc4fd2ec9a8195de69f878615565c9dcda3687041 (diff)
parentd33ba3bb9c5f09374dd585cc6f0ff6294b98fc6a (diff)
downloadscala-d61d007d4852032fcfd339ab2c904a4de6836c4d.tar.gz
scala-d61d007d4852032fcfd339ab2c904a4de6836c4d.tar.bz2
scala-d61d007d4852032fcfd339ab2c904a4de6836c4d.zip
Merge pull request #4052 from Lymia/issue/8910
SI-8910 BitSet sometimes uses exponential memory.
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/collection/mutable/BitSet.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/library/scala/collection/mutable/BitSet.scala b/src/library/scala/collection/mutable/BitSet.scala
index 43d23acc1a..faa4155317 100644
--- a/src/library/scala/collection/mutable/BitSet.scala
+++ b/src/library/scala/collection/mutable/BitSet.scala
@@ -110,7 +110,7 @@ class BitSet(protected final var elems: Array[Long]) extends AbstractSet[Int]
* @return the bitset itself.
*/
def |= (other: BitSet): this.type = {
- ensureCapacity(other.nwords)
+ ensureCapacity(other.nwords - 1)
for (i <- 0 until other.nwords)
elems(i) = elems(i) | other.word(i)
this
@@ -121,7 +121,7 @@ class BitSet(protected final var elems: Array[Long]) extends AbstractSet[Int]
* @return the bitset itself.
*/
def &= (other: BitSet): this.type = {
- ensureCapacity(other.nwords)
+ ensureCapacity(other.nwords - 1)
for (i <- 0 until other.nwords)
elems(i) = elems(i) & other.word(i)
this
@@ -132,7 +132,7 @@ class BitSet(protected final var elems: Array[Long]) extends AbstractSet[Int]
* @return the bitset itself.
*/
def ^= (other: BitSet): this.type = {
- ensureCapacity(other.nwords)
+ ensureCapacity(other.nwords - 1)
for (i <- 0 until other.nwords)
elems(i) = elems(i) ^ other.word(i)
this
@@ -143,7 +143,7 @@ class BitSet(protected final var elems: Array[Long]) extends AbstractSet[Int]
* @return the bitset itself.
*/
def &~= (other: BitSet): this.type = {
- ensureCapacity(other.nwords)
+ ensureCapacity(other.nwords - 1)
for (i <- 0 until other.nwords)
elems(i) = elems(i) & ~other.word(i)
this