Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

#CLJ-836: optimzation should not demote BigInts

Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
  • Loading branch information...
commit 43bc5b79713e482f082ba62aba918cfa689a847b 1 parent e929787
@stuarthalloway stuarthalloway authored
Showing with 8 additions and 8 deletions.
  1. +8 −8 src/jvm/clojure/lang/BigInt.java
View
16 src/jvm/clojure/lang/BigInt.java
@@ -124,34 +124,34 @@ public int bitLength(){
return toBigInteger().bitLength();
}
-public Number add(BigInt y) {
+public BigInt add(BigInt y) {
if ((bipart == null) && (y.bipart == null)) {
long ret = lpart + y.lpart;
if ((ret ^ lpart) >= 0 || (ret ^ y.lpart) >= 0)
- return ret;
+ return BigInt.valueOf(ret);
}
return BigInt.fromBigInteger(this.toBigInteger().add(y.toBigInteger()));
}
-public Number multiply(BigInt y) {
+public BigInt multiply(BigInt y) {
if ((bipart == null) && (y.bipart == null)) {
long ret = lpart * y.lpart;
if (y.lpart == 0 || ret / y.lpart == lpart)
- return ret;
+ return BigInt.valueOf(ret);
}
return BigInt.fromBigInteger(this.toBigInteger().multiply(y.toBigInteger()));
}
-public Number quotient(BigInt y) {
+public BigInt quotient(BigInt y) {
if ((bipart == null) && (y.bipart == null)) {
- return lpart / y.lpart;
+ return BigInt.valueOf(lpart / y.lpart);
}
return BigInt.fromBigInteger(this.toBigInteger().divide(y.toBigInteger()));
}
-public Number remainder(BigInt y) {
+public BigInt remainder(BigInt y) {
if ((bipart == null) && (y.bipart == null)) {
- return lpart % y.lpart;
+ return BigInt.valueOf(lpart % y.lpart);
}
return BigInt.fromBigInteger(this.toBigInteger().remainder(y.toBigInteger()));
}
Please sign in to comment.
Something went wrong with that request. Please try again.