diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2005-12-15 21:19:07 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2005-12-15 21:19:07 +0000 |
commit | db7046b4e11fa5547bcd875f8285ec7418986a2d (patch) | |
tree | 3e1323d892b723c25080201038a66c8c1522050a /sources | |
parent | bc1714113b80807451689b1f3e244640e3874612 (diff) | |
download | scala-db7046b4e11fa5547bcd875f8285ec7418986a2d.tar.gz scala-db7046b4e11fa5547bcd875f8285ec7418986a2d.tar.bz2 scala-db7046b4e11fa5547bcd875f8285ec7418986a2d.zip |
Added arithmetic operations to Long for Int, Sh...
Added arithmetic operations to Long for Int, Short, Char, Byte.
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scala/Long.java | 61 | ||||
-rw-r--r-- | sources/scalac/backend/Primitives.java | 28 |
2 files changed, 75 insertions, 14 deletions
diff --git a/sources/scala/Long.java b/sources/scala/Long.java index d3425fb75b..8ef9453f3b 100644 --- a/sources/scala/Long.java +++ b/sources/scala/Long.java @@ -117,4 +117,65 @@ public abstract class Long extends AnyVal implements java.io.Serializable { public long $amp (long that) { return value & that; } public long $up (long that) { return value ^ that; } + + public boolean $eq$eq (int that) { return value == that; } + public boolean $bang$eq (int that) { return value != that; } + public boolean $less (int that) { return value < that; } + public boolean $greater (int that) { return value > that; } + public boolean $less$eq (int that) { return value <= that; } + public boolean $greater$eq(int that) { return value >= that; } + public long $plus (int that) { return value + that; } + public long $minus (int that) { return value - that; } + public long $times (int that) { return value * that; } + public long $div (int that) { return value / that; } + public long $percent (int that) { return value % that; } + public long $bar (int that) { return value | that; } + public long $amp (int that) { return value & that; } + public long $up (int that) { return value ^ that; } + + public boolean $eq$eq (short that) { return value == that; } + public boolean $bang$eq (short that) { return value != that; } + public boolean $less (short that) { return value < that; } + public boolean $greater (short that) { return value > that; } + public boolean $less$eq (short that) { return value <= that; } + public boolean $greater$eq(short that) { return value >= that; } + public long $plus (short that) { return value + that; } + public long $minus (short that) { return value - that; } + public long $times (short that) { return value * that; } + public long $div (short that) { return value / that; } + public long $percent (short that) { return value % that; } + public long $bar (short that) { return value | that; } + public long $amp (short that) { return value & that; } + public long $up (short that) { return value ^ that; } + + public boolean $eq$eq (char that) { return value == that; } + public boolean $bang$eq (char that) { return value != that; } + public boolean $less (char that) { return value < that; } + public boolean $greater (char that) { return value > that; } + public boolean $less$eq (char that) { return value <= that; } + public boolean $greater$eq(char that) { return value >= that; } + public long $plus (char that) { return value + that; } + public long $minus (char that) { return value - that; } + public long $times (char that) { return value * that; } + public long $div (char that) { return value / that; } + public long $percent (char that) { return value % that; } + public long $bar (char that) { return value | that; } + public long $amp (char that) { return value & that; } + public long $up (char that) { return value ^ that; } + + public boolean $eq$eq (byte that) { return value == that; } + public boolean $bang$eq (byte that) { return value != that; } + public boolean $less (byte that) { return value < that; } + public boolean $greater (byte that) { return value > that; } + public boolean $less$eq (byte that) { return value <= that; } + public boolean $greater$eq(byte that) { return value >= that; } + public long $plus (byte that) { return value + that; } + public long $minus (byte that) { return value - that; } + public long $times (byte that) { return value * that; } + public long $div (byte that) { return value / that; } + public long $percent (byte that) { return value % that; } + public long $bar (byte that) { return value | that; } + public long $amp (byte that) { return value & that; } + public long $up (byte that) { return value ^ that; } + } diff --git a/sources/scalac/backend/Primitives.java b/sources/scalac/backend/Primitives.java index 6a67e123e6..fb2b49a3b0 100644 --- a/sources/scalac/backend/Primitives.java +++ b/sources/scalac/backend/Primitives.java @@ -606,25 +606,25 @@ public class Primitives { // scala.Long addAll(defs.LONG_CLASS, Names.coerce, Primitive.COERCE, 2); //addAll(defs.LONG_CLASS, Names.EQ, Primitive.EQ, 4); - addAllPrimitive(defs.LONG_CLASS, Names.EQ, Primitive.EQ, 3); + addAllPrimitive(defs.LONG_CLASS, Names.EQ, Primitive.EQ, 7); //addAll(defs.LONG_CLASS, Names.NE, Primitive.NE, 4); - addAllPrimitive(defs.LONG_CLASS, Names.NE, Primitive.NE, 3); + addAllPrimitive(defs.LONG_CLASS, Names.NE, Primitive.NE, 7); //addAll(defs.LONG_CLASS, Names.equals, Primitive.EQUALS, 1); addAll(defs.LONG_CLASS, Names.hashCode, Primitive.HASHCODE, 1); addAll(defs.LONG_CLASS, Names.toString, Primitive.TOSTRING, 1); addAll(defs.LONG_CLASS, Names.NOT, Primitive.NOT, 1); - addAdd(defs.LONG_CLASS, 3); - addSub(defs.LONG_CLASS, 3); - addAll(defs.LONG_CLASS, Names.MUL, Primitive.MUL, 3); - addAll(defs.LONG_CLASS, Names.DIV, Primitive.DIV, 3); - addAll(defs.LONG_CLASS, Names.MOD, Primitive.MOD, 3); - addAll(defs.LONG_CLASS, Names.LT, Primitive.LT, 3); - addAll(defs.LONG_CLASS, Names.LE, Primitive.LE, 3); - addAll(defs.LONG_CLASS, Names.GT, Primitive.GT, 3); - addAll(defs.LONG_CLASS, Names.GE, Primitive.GE, 3); - addAll(defs.LONG_CLASS, Names.OR, Primitive.OR, 1); - addAll(defs.LONG_CLASS, Names.XOR, Primitive.XOR, 1); - addAll(defs.LONG_CLASS, Names.AND, Primitive.AND, 1); + addAdd(defs.LONG_CLASS, 7); + addSub(defs.LONG_CLASS, 7); + addAll(defs.LONG_CLASS, Names.MUL, Primitive.MUL, 7); + addAll(defs.LONG_CLASS, Names.DIV, Primitive.DIV, 7); + addAll(defs.LONG_CLASS, Names.MOD, Primitive.MOD, 7); + addAll(defs.LONG_CLASS, Names.LT, Primitive.LT, 7); + addAll(defs.LONG_CLASS, Names.LE, Primitive.LE, 7); + addAll(defs.LONG_CLASS, Names.GT, Primitive.GT, 7); + addAll(defs.LONG_CLASS, Names.GE, Primitive.GE, 7); + addAll(defs.LONG_CLASS, Names.OR, Primitive.OR, 5); + addAll(defs.LONG_CLASS, Names.XOR, Primitive.XOR, 5); + addAll(defs.LONG_CLASS, Names.AND, Primitive.AND, 5); addAll(defs.LONG_CLASS, Names.LSL, Primitive.LSL, 2); addAll(defs.LONG_CLASS, Names.LSR, Primitive.LSR, 2); addAll(defs.LONG_CLASS, Names.ASR, Primitive.ASR, 2); |