summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Powell <djpowell@djpowell.net>2011-01-24 22:56:17 +0000
committerStuart Halloway <stu@Stuart-Halloways-MacBook-Air.local>2011-02-25 14:34:46 -0500
commitb5fc9ffeff3ba2831095feb8cbf181beb9a0cb68 (patch)
tree707fd5694fa6ea215a23b769024533f468a7a430
parent815c02ab66e4a7188c151506f6402a3df1c9297d (diff)
add missing overloads for numerics to prevent major performance regression due to clojure.core functions making slow reflective calls
Signed-off-by: Stuart Halloway <stu@Stuart-Halloways-MacBook-Air.local>
-rw-r--r--src/jvm/clojure/lang/Numbers.java47
1 files changed, 44 insertions, 3 deletions
diff --git a/src/jvm/clojure/lang/Numbers.java b/src/jvm/clojure/lang/Numbers.java
index 545bb727..a5d11fdb 100644
--- a/src/jvm/clojure/lang/Numbers.java
+++ b/src/jvm/clojure/lang/Numbers.java
@@ -1633,12 +1633,41 @@ static public long and(long x, long y){
return x & y;
}
+static public Number and(Object x, long y){
+ return and(x, (Object)y);
+}
+
+static public Number and(long x, Object y){
+ return and((Object)x, y);
+}
+
+static public long andNot(long x, long y){
+ return x & ~y;
+}
+
+static public Number andNot(Object x, long y){
+ return andNot((Number)x, (Number)y);
+}
+
+static public Number andNot(long x, Object y){
+ return andNot((Number)x, (Number)y);
+}
+
+
//static public int or(int x, int y){
// return x | y;
//}
static public long or(long x, long y){
- return x | y;
+ return x | y;
+}
+
+static public Number or(Object x, long y){
+ return or(x, (Object)y);
+}
+
+static public Number or(long x, Object y){
+ return or((Object)x, y);
}
//static public int xor(int x, int y){
@@ -1646,7 +1675,15 @@ static public long or(long x, long y){
//}
static public long xor(long x, long y){
- return x ^ y;
+ return x ^ y;
+}
+
+static public Number xor(Object x, long y){
+ return xor(x, (Object)y);
+}
+
+static public Number xor(long x, Object y){
+ return xor((Object)x, y);
}
//static public int minus(int x, int y){
@@ -3784,7 +3821,11 @@ static public double divide(double x, long y){
}
static public double divide(long x, double y){
- return x / y;
+ return x / y;
+}
+
+static public Number divide(long x, long y){
+ return divide((Number)x, (Number)y);
}
static public boolean lt(long x, Object y){