Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

Types.java

00001 package gov.nasa.arc.ase.jpf.jvm;
00002 
00003 import de.fub.bytecode.Constants;
00004 import de.fub.bytecode.generic.Type;
00005 
00006 public class Types implements Constants {
00007   public static int booleanToInt(boolean b) { return b ? 1 : 0; }  
00008   public static long doubleToLong(double d) { return Double.doubleToLongBits(d); }  
00009   public static int floatToInt(float f) { return Float.floatToIntBits(f); }  
00010   public static int getType(String signature) {
00011     return Type.getType(signature).getType();
00012   }  
00013   public static int hiDouble(double d) { return hiLong(Double.doubleToLongBits(d)); }  
00014   public static int hiLong(long l) { return (int)(l >> 32); }  
00015   public static double intsToDouble(int l, int h) { return longToDouble(intsToLong(l, h)); }  
00016   public static long intsToLong(int l, int h) { return (((long)h) << 32) + l; }  
00017   public static boolean intToBoolean(int i) { return i != 0; }  
00018   public static float intToFloat(int i) { return Float.intBitsToFloat(i); }  
00019   public static boolean isReference(String signature) {
00020     int t = getType(signature);
00021     return t == T_ARRAY || t == T_REFERENCE;
00022   }  
00023   public static int loDouble(double d) { return loLong(Double.doubleToLongBits(d)); }  
00024   public static int loLong(long l) { return (int)(l & 0xFFFFFFFF); }  
00025   public static double longToDouble(long l) { return Double.longBitsToDouble(l); }  
00026   public static long newValue(String signature) {
00027     switch(getType(signature)) {
00028       case T_BOOLEAN:
00029       case T_BYTE:
00030       case T_CHAR:
00031       case T_DOUBLE:
00032       case T_FLOAT:
00033       case T_INT:
00034       case T_LONG:
00035       case T_SHORT:
00036     return (long)0;
00037     
00038       case T_ARRAY:
00039       case T_REFERENCE:
00040     return (long)-1;
00041     }
00042 
00043     return 0;
00044   }  
00045 }

Generated at Thu Feb 7 06:58:53 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001