diff graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java @ 5874:f0d4304243ff

Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros) Add tests for those methods
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 24 Jul 2012 17:32:42 +0200
parents 6c80d73cf81a
children 7ac010ae8c97
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java	Mon Jul 23 16:50:10 2012 +0200
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java	Tue Jul 24 17:32:42 2012 +0200
@@ -438,4 +438,23 @@
         }
     }
 
+    public int bits() {
+        switch (this) {
+            case Boolean:
+                return 1;
+            case Byte:
+                return 8;
+            case Char:
+                return 16;
+            case Short:
+                return 16;
+            case Jsr:
+            case Int:
+                return 32;
+            case Long:
+                return 64;
+            default:
+                throw new IllegalArgumentException("illegal call to bits on " + this);
+        }
+    }
 }