/* tests/jctest.java - checks most of the JVM instructions
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
TU Wien
Contact: cacao@cacaojvm.org
Authors: Reinhard Grafl
-
- Changes: Christian Thalinger
-
- $Id: jctest.java 4357 2006-01-22 23:33:38Z twisti $
+ Christian Thalinger
*/
}
static public void testdivremconst(int a) {
+ p("IDIVPOW2 (" + a + " / 0x00000001): ", a / 0x00000001);
p("IDIVPOW2 (" + a + " / 0x00000002): ", a / 0x00000002);
p("IDIVPOW2 (" + a + " / 0x00000004): ", a / 0x00000004);
p("IDIVPOW2 (" + a + " / 0x00000008): ", a / 0x00000008);
p("IDIVPOW2 (" + a + " / 0x40000000): ", a / 0x40000000);
p("IDIVPOW2 (" + a + " / 0x80000000): ", a / 0x80000000);
+ p("IREMPOW2 (" + a + " % 0x00000001): ", a % 0x00000001);
p("IREMPOW2 (" + a + " % 0x00000002): ", a % 0x00000002);
p("IREMPOW2 (" + a + " % 0x00000004): ", a % 0x00000004);
p("IREMPOW2 (" + a + " % 0x00000008): ", a % 0x00000008);
}
static public void testdivremconst(long a) {
+ p("LDIVPOW2 (" + a + " / 0x00000001): ", a / 0x00000001);
p("LDIVPOW2 (" + a + " / 0x00000002): ", a / 0x00000002);
p("LDIVPOW2 (" + a + " / 0x00000004): ", a / 0x00000004);
p("LDIVPOW2 (" + a + " / 0x00000008): ", a / 0x00000008);
p("LDIVPOW2 (" + a + " / 0x40000000): ", a / 0x40000000);
p("LDIVPOW2 (" + a + " / 0x80000000): ", a / 0x80000000);
+ p("LREMPOW2 (" + a + " % 0x00000001): ", a % 0x00000001L);
p("LREMPOW2 (" + a + " % 0x00000002): ", a % 0x00000002L);
p("LREMPOW2 (" + a + " % 0x00000004): ", a % 0x00000004L);
p("LREMPOW2 (" + a + " % 0x00000008): ", a % 0x00000008L);
}
public static void p(String a) { System.out.print(a); pnl(); }
- public static void p(boolean a) {System.out.print(a);
- pnl(); }
- public static void p(int a) { System.out.print ("int: ");
- System.out.print(a);
- pnl(); }
- public static void p(long a) { System.out.print ("long: ");
- System.out.print(a);
- pnl(); }
- public static void p(short a) { System.out.print ("short: ");
- System.out.print(a);
- pnl(); }
- public static void p(byte a) { System.out.print ("byte: ");
- System.out.print(a);
- pnl(); }
- public static void p(char a) { System.out.print ("char: ");
- System.out.print((int) a);
- pnl(); }
- public static void p(float a) { System.out.print ("float: ");
- System.out.print ( java.lang.Float.floatToIntBits(a) );
- pnl(); }
- public static void p(double a) { System.out.print ("double: ");
- System.out.print( java.lang.Double.doubleToLongBits(a) );
- pnl(); }
+
+ public static void p(boolean a) {
+ System.out.print(a);
+ pnl();
+ }
+
+ public static void p(byte a) {
+ System.out.print("byte: ");
+ System.out.print(a);
+ System.out.print(" (0x");
+ System.out.print(Integer.toHexString(a));
+ System.out.print(")");
+ pnl();
+ }
+
+ public static void p(char a) {
+ System.out.print("char: ");
+ System.out.print((int) a);
+ System.out.print(" (0x");
+ System.out.print(Integer.toHexString((int) a));
+ System.out.print(")");
+ pnl();
+ }
+
+ public static void p(short a) {
+ System.out.print("short: ");
+ System.out.print(a);
+ System.out.print(" (0x");
+ System.out.print(Integer.toHexString(a));
+ System.out.print(")");
+ pnl();
+ }
+
+ public static void p(int a) {
+ System.out.print ("int: ");
+ System.out.print(a);
+ System.out.print(" (0x");
+ System.out.print(Integer.toHexString(a));
+ System.out.print(")");
+ pnl();
+ }
+
+ public static void p(long a) {
+ System.out.print ("long: ");
+ System.out.print(a);
+ System.out.print(" (0x");
+ System.out.print(Long.toHexString(a));
+ System.out.print(")");
+ pnl();
+ }
+
+ public static void p(float a) {
+ int i = Float.floatToIntBits(a);
+ System.out.print("float: ");
+ System.out.print(i);
+ System.out.print(" (0x");
+ System.out.print(Integer.toHexString(i));
+ System.out.print(")");
+ pnl();
+ }
+
+ public static void p(double a) {
+ long l = Double.doubleToLongBits(a);
+ System.out.print("double: ");
+ System.out.print(l);
+ System.out.print(" (0x");
+ System.out.print(Long.toHexString(l));
+ System.out.print(")");
+ pnl();
+ }
public static void p(String s,boolean i) {
System.out.print(s); p(i);