Skip to content

Commit a483eac

Browse files
committed
[Truffle] Fix a couple specializationsin FixnumNodes.
1 parent bacbde8 commit a483eac

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

core/src/main/java/org/jruby/truffle/nodes/core/FixnumNodes.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,9 @@ public int neg(int value) {
6666
return ExactMath.subtractExact(0, value);
6767
}
6868

69-
@Specialization(rewriteOn = ArithmeticException.class)
70-
public long negWithLongOverflow(int value) {
71-
return ExactMath.subtractExact(0, (long) value);
72-
}
73-
7469
@Specialization
75-
public BigInteger negWithBigIntegerOverflow(int value) {
76-
return BigInteger.valueOf(value).negate();
70+
public long negWithLongOverflow(int value) {
71+
return -((long) value);
7772
}
7873

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

216211
@Specialization
217212
public long mulWithLong(int a, int b) {
218-
return ExactMath.multiplyExact((long) a, (long) b);
213+
return (long) a * (long) b;
219214
}
220215

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

226221
@Specialization(rewriteOn = ArithmeticException.class)
227-
public Object mul(long a, long b) {
222+
public long mul(long a, long b) {
228223
return ExactMath.multiplyExact(a, b);
229224
}
230225

0 commit comments

Comments
 (0)