提交 16d47524 编写于 作者: D Dmitry Jemerov

long cmp

上级 807b669b
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册