long cmp
This commit is contained in:
@@ -512,7 +512,7 @@ public class ExpressionCodegen extends JetVisitor {
|
||||
|
||||
private static boolean isNumberPrimitive(Type type) {
|
||||
return type == Type.INT_TYPE || type == Type.SHORT_TYPE || type == Type.BYTE_TYPE || type == Type.CHAR_TYPE ||
|
||||
type == Type.FLOAT_TYPE || type == Type.DOUBLE_TYPE;
|
||||
type == Type.FLOAT_TYPE || type == Type.DOUBLE_TYPE || type == Type.LONG_TYPE;
|
||||
}
|
||||
|
||||
private static int opcodeForMethod(final String name) {
|
||||
|
||||
@@ -166,6 +166,9 @@ public abstract class StackValue {
|
||||
v.cmpl(type);
|
||||
}
|
||||
}
|
||||
else if (type == Type.LONG_TYPE) {
|
||||
v.lcmp();
|
||||
}
|
||||
else {
|
||||
opcode += (Opcodes.IF_ICMPEQ - Opcodes.IFEQ);
|
||||
}
|
||||
|
||||
@@ -237,11 +237,11 @@ public class NamespaceGenTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testLongCmp() throws Exception {
|
||||
loadText("fun foo(a: Long, b: Long): Long = if (a == b) 0xffffffff else 0.lng");
|
||||
loadText("fun foo(a: Long, b: Long): Long = if (a == b) 0xffffffff else 0xfffffffe");
|
||||
System.out.println(generateToText());
|
||||
final Method main = generateFunction();
|
||||
assertEquals(0xffffffffL, main.invoke(null, 1, 1));
|
||||
assertEquals(0L, main.invoke(null, 1, 0));
|
||||
assertEquals(0xfffffffeL, main.invoke(null, 1, 0));
|
||||
}
|
||||
|
||||
public void testShort() throws Exception {
|
||||
@@ -266,7 +266,7 @@ public class NamespaceGenTest extends LightCodeInsightFixtureTestCase {
|
||||
|
||||
public void testByteLess() throws Exception {
|
||||
binOpTest("fun foo(a: Byte, b: Byte): Boolean = a < b",
|
||||
Byte.valueOf((byte) 126), Byte.valueOf((byte) 127), 1);
|
||||
Byte.valueOf((byte) 126), Byte.valueOf((byte) 127), true);
|
||||
}
|
||||
|
||||
public void testBooleanConstant() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user