Class UnsafeLongArrayAccess


  • public final class UnsafeLongArrayAccess
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      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 calcLongElementOffset​(long index)  
      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 Detail

      • LONG_ARRAY_BASE

        public static final long LONG_ARRAY_BASE
      • LONG_ELEMENT_SHIFT

        public static final int LONG_ELEMENT_SHIFT
    • Constructor Detail

      • UnsafeLongArrayAccess

        public UnsafeLongArrayAccess()
    • Method Detail

      • 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.