Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 arch/x86/insn-selector.brg         |    2 ++
 regression/jvm/ConversionTest.java |   11 +++++++++++
 regression/jvm/TestCase.java       |    6 ++++++
 3 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index f07d09f..edea89c 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -1439,6 +1439,8 @@ reg:      EXPR_CONVERSION(reg)
                state->reg1 = get_var(s->b_parent, J_INT);
 
                select_insn(s, tree, reg_reg_insn(INSN_MOVSX_16_REG_REG, 
state->left->reg1, state->reg1));
+       } else if (src->vm_type == J_BYTE && expr->vm_type == J_CHAR) {
+               state->reg1 = state->left->reg1;
        } else {
                die("EXPR_CONVERSION: no conversion from %d to %d", 
src->vm_type, expr->vm_type);
        }
diff --git a/regression/jvm/ConversionTest.java 
b/regression/jvm/ConversionTest.java
index 001cda1..93b2a95 100644
--- a/regression/jvm/ConversionTest.java
+++ b/regression/jvm/ConversionTest.java
@@ -87,11 +87,22 @@ public class ConversionTest extends TestCase {
         assertEquals(-1, i2s(Integer.MAX_VALUE));
     }
 
+    public static char b2c(byte b) {
+        return (char) b;
+    }
+
+    public static void testByteToCharConversion() {
+        assertEquals(0, b2c((byte) 0));
+        assertEquals((char) 0x7f, b2c((byte) 0x7f));
+        assertEquals((char) 0xffc0, b2c((byte) -0x40));
+    }
+
     public static void main(String[] args) {
         testLongToIntegerConversion();
         testIntegerToLongConversion();
         testIntegerToByteConversion();
         testIntegerToCharConversion();
         testIntegerToShortConversion();
+        testByteToCharConversion();
     }
 }
diff --git a/regression/jvm/TestCase.java b/regression/jvm/TestCase.java
index 7b85a98..fd00063 100644
--- a/regression/jvm/TestCase.java
+++ b/regression/jvm/TestCase.java
@@ -50,6 +50,12 @@ public class TestCase {
         }
     }
 
+    public static void assertEquals(char expected, char actual) {
+        if (expected != actual) {
+            fail("Expected '" + expected + "', but was '" + actual + "'.");
+        }
+    }
+
     protected static void assertEquals(Object expected, Object actual) {
         if (expected != actual) {
             fail("Expected '" + expected + "', but was '" + actual + "'.");
-- 
1.6.0.6


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to