Skip to content

Commit

Permalink
[Truffle] Fix a couple specializationsin FixnumNodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Oct 28, 2014
1 parent bacbde8 commit a483eac
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions core/src/main/java/org/jruby/truffle/nodes/core/FixnumNodes.java
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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);
}

Expand Down

0 comments on commit a483eac

Please sign in to comment.