Skip to content

Commit

Permalink
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -61,9 +61,12 @@ public int neg(int value) {
return ExactMath.subtractExact(0, value);
}

@Specialization
public long negWithOverflow(int value) {
return -(long) (value);
@Specialization(contains = "neg")
public Object negWithOverflow(int value) {
if (value == Integer.MIN_VALUE) {
return -((long) value);
}
return -value;
}

@Specialization(rewriteOn = ArithmeticException.class)

0 comments on commit 1bc0d90

Please sign in to comment.