changeset 13504:5aaae6e76a2a

Utility method to convert a long to a pointer
author Christian Wimmer <christian.wimmer@oracle.com>
date Fri, 03 Jan 2014 11:56:49 -0800
parents b5d418c12ed5
children 75a67ebd50e8
files graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java	Fri Jan 03 11:55:58 2014 -0800
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java	Fri Jan 03 11:56:49 2014 -0800
@@ -111,6 +111,19 @@
     }
 
     /**
+     * Unsafe conversion from a Java long value to a {@link PointerBase pointer}. The parameter is
+     * treated as an unsigned 64-bit value (in contrast to the semantics of a Java long).
+     * 
+     * @param val a 64 bit unsigned value
+     * @return the value cast to PointerBase
+     */
+    @Operation(opcode = Opcode.FROM_UNSIGNED)
+    @SuppressWarnings("unchecked")
+    public static <T extends PointerBase> T pointer(long val) {
+        return (T) box(val);
+    }
+
+    /**
      * Unsafe conversion from a Java int value to a Word. The parameter is treated as an unsigned
      * 32-bit value (in contrast to the semantics of a Java int).
      *