Class WordFactory

java.lang.Object
org.graalvm.word.WordFactory

public final class WordFactory extends Object
Provides factory method to create machine-word-sized values.
Since:
19.0
  • Method Details

    • zero

      public static <T extends WordBase> T zero()
      The constant 0, i.e., the word with no bits set. There is no difference between a signed and unsigned zero.
      Returns:
      the constant 0.
      Since:
      19.0
    • nullPointer

      public static <T extends PointerBase> T nullPointer()
      The null pointer, i.e., the pointer with no bits set. There is no difference to a signed or unsigned zero().
      Returns:
      the null pointer.
      Since:
      19.0
    • unsigned

      public static <T extends UnsignedWord> T unsigned(long val)
      Unsafe conversion from a Java long value to a Word. The parameter is treated as an unsigned 64-bit value (in contrast to the semantics of a Java long).
      Parameters:
      val - a 64 bit unsigned value
      Returns:
      the value cast to Word
      Since:
      19.0
    • pointer

      public static <T extends PointerBase> T pointer(long val)
      Unsafe conversion from a Java long value to a pointer. The parameter is treated as an unsigned 64-bit value (in contrast to the semantics of a Java long).
      Parameters:
      val - a 64 bit unsigned value
      Returns:
      the value cast to PointerBase
      Since:
      19.0
    • unsigned

      public static <T extends UnsignedWord> T unsigned(int 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).
      Parameters:
      val - a 32 bit unsigned value
      Returns:
      the value cast to Word
      Since:
      19.0
    • signed

      public static <T extends SignedWord> T signed(long val)
      Unsafe conversion from a Java long value to a Word. The parameter is treated as a signed 64-bit value (unchanged semantics of a Java long).
      Parameters:
      val - a 64 bit signed value
      Returns:
      the value cast to Word
      Since:
      19.0
    • signed

      public static <T extends SignedWord> T signed(int val)
      Unsafe conversion from a Java int value to a Word. The parameter is treated as a signed 32-bit value (unchanged semantics of a Java int).
      Parameters:
      val - a 32 bit signed value
      Returns:
      the value cast to Word
      Since:
      19.0