Skip to content

Commit cb3ba84

Browse files
committed
Avoid putting big positive state ids into the bitset.
1 parent 3afae7d commit cb3ba84

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/scala/scala/async/internal/StateSet.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class StateSet {
1414
private var bitSet = new java.util.BitSet()
1515
private var caseSet = new util.HashSet[Integer]()
1616
def +=(stateId: Int): Unit = if (stateId > 0) bitSet.set(stateId) else caseSet.add(stateId)
17-
def contains(stateId: Int): Boolean = if (stateId > 0) bitSet.get(stateId) else caseSet.contains(stateId)
17+
def contains(stateId: Int): Boolean = if (stateId > 0 && stateId < 1024) bitSet.get(stateId) else caseSet.contains(stateId)
1818
def iterator: Iterator[Integer] = {
1919
bitSet.stream().iterator().asScala ++ caseSet.asScala.iterator
2020
}

0 commit comments

Comments
 (0)