Skip to content

Commit 8c3a8cd

Browse files
authored
chore: Avoid left-shift of negative values port google/jsonnet#1288 (#612)
Avoid left-shift of negative values port
1 parent 11927e8 commit 8c3a8cd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

sjsonnet/src/sjsonnet/Evaluator.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ class Evaluator(
568568
if (rr < 0) {
569569
Error.fail("shift by negative exponent", pos)
570570
}
571-
if (rr >= 1 && ll >= (1L << (63 - rr)))
571+
if (rr >= 1 && math.abs(ll) >= (1L << (63 - rr)))
572572
Error.fail("numeric value outside safe integer range for bitwise operation", pos)
573573
else
574574
Val.Num(pos, (ll << rr).toDouble)

0 commit comments

Comments
 (0)