Skip to content

Commit

Permalink
[Truffle] Fixing Fixnum#-@ overflow specialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
bjfish committed Apr 9, 2015
1 parent af2e4db commit 1bc0d90
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -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)
Expand Down

0 comments on commit 1bc0d90

Please sign in to comment.