Skip to content

Commit ead6684

Browse files
authored
Merge pull request scala/scala#10139 from jxnu-liguobin/p12635-range-contains
2 parents 8084294 + 82c4ed1 commit ead6684

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/src/scala/collection/immutable/Range.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,11 @@ sealed abstract class Range(
373373
if (x == end && !isInclusive) false
374374
else if (step > 0) {
375375
if (x < start || x > end) false
376-
else (step == 1) || (((x - start) % step) == 0)
376+
else (step == 1) || (Integer.remainderUnsigned(x - start, step) == 0)
377377
}
378378
else {
379379
if (x < end || x > start) false
380-
else (step == -1) || (((x - start) % step) == 0)
380+
else (step == -1) || (Integer.remainderUnsigned(start - x, -step) == 0)
381381
}
382382
}
383383
/* Seq#contains has a type parameter so the optimised contains above doesn't override it */

0 commit comments

Comments
 (0)