Skip to content
Permalink
Browse files
[Truffle] Fix a couple specializationsin FixnumNodes.
  • Loading branch information
eregon committed Oct 28, 2014
1 parent bacbde8 commit a483eac4ffd79122e4450198136a5abfee8288f2
Showing 1 changed file with 4 additions and 9 deletions.
@@ -66,14 +66,9 @@ public int neg(int value) {
return ExactMath.subtractExact(0, value);
}

@Specialization(rewriteOn = ArithmeticException.class)
public long negWithLongOverflow(int value) {
return ExactMath.subtractExact(0, (long) value);
}

@Specialization
public BigInteger negWithBigIntegerOverflow(int value) {
return BigInteger.valueOf(value).negate();
public long negWithLongOverflow(int value) {
return -((long) value);
}

@Specialization(rewriteOn = ArithmeticException.class)
@@ -215,7 +210,7 @@ public int mul(int a, int b) {

@Specialization
public long mulWithLong(int a, int b) {
return ExactMath.multiplyExact((long) a, (long) b);
return (long) a * (long) b;
}

@Specialization
@@ -224,7 +219,7 @@ public double mul(int a, double b) {
}

@Specialization(rewriteOn = ArithmeticException.class)
public Object mul(long a, long b) {
public long mul(long a, long b) {
return ExactMath.multiplyExact(a, b);
}

0 comments on commit a483eac

Please sign in to comment.