Skip to content

Commit

Permalink
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
Original file line number Diff line number Diff line change
@@ -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.