Class UnsafeLongArrayAccess

java.lang.Object
org.jctools.util.UnsafeLongArrayAccess

public final class UnsafeLongArrayAccess extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
     
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static long[]
    allocateLongArray(int capacity)
    This makes for an easier time generating the atomic queues, and removes some warnings.
    static long
    calcCircularLongElementOffset(long index, long mask)
    Note: circular arrays are assumed a power of 2 in length and the `mask` is (length - 1).
    static long
     
    static long
    lpLongElement(long[] buffer, long offset)
    A plain load (no ordering/fences) of an element from a given offset.
    static long
    lvLongElement(long[] buffer, long offset)
    A volatile load of an element from a given offset.
    static void
    soLongElement(long[] buffer, long offset, long e)
    An ordered store of an element to a given offset
    static void
    spLongElement(long[] buffer, long offset, long e)
    A plain store (no ordering/fences) of an element to a given offset

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LONG_ARRAY_BASE

      public static final long LONG_ARRAY_BASE
    • LONG_ELEMENT_SHIFT

      public static final int LONG_ELEMENT_SHIFT
  • Constructor Details

    • UnsafeLongArrayAccess

      public UnsafeLongArrayAccess()
  • Method Details

    • spLongElement

      public static void spLongElement(long[] buffer, long offset, long e)
      A plain store (no ordering/fences) of an element to a given offset
      Parameters:
      buffer - le buffer
      offset - computed via calcLongElementOffset(long)
      e - an orderly kitty
    • soLongElement

      public static void soLongElement(long[] buffer, long offset, long e)
      An ordered store of an element to a given offset
      Parameters:
      buffer - le buffer
      offset - computed via calcCircularLongElementOffset(long, long)
      e - an orderly kitty
    • lpLongElement

      public static long lpLongElement(long[] buffer, long offset)
      A plain load (no ordering/fences) of an element from a given offset.
      Parameters:
      buffer - le buffer
      offset - computed via calcLongElementOffset(long)
      Returns:
      the element at the offset
    • lvLongElement

      public static long lvLongElement(long[] buffer, long offset)
      A volatile load of an element from a given offset.
      Parameters:
      buffer - le buffer
      offset - computed via calcCircularLongElementOffset(long, long)
      Returns:
      the element at the offset
    • calcLongElementOffset

      public static long calcLongElementOffset(long index)
      Parameters:
      index - desirable element index
      Returns:
      the offset in bytes within the array for a given index
    • calcCircularLongElementOffset

      public static long calcCircularLongElementOffset(long index, long mask)
      Note: circular arrays are assumed a power of 2 in length and the `mask` is (length - 1).
      Parameters:
      index - desirable element index
      mask - (length - 1)
      Returns:
      the offset in bytes within the circular array for a given index
    • allocateLongArray

      public static long[] allocateLongArray(int capacity)
      This makes for an easier time generating the atomic queues, and removes some warnings.