Package org.jctools.util
Class UnsafeLongArrayAccess
java.lang.Object
org.jctools.util.UnsafeLongArrayAccess
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 offsetstatic void
spLongElement
(long[] buffer, long offset, long e) A plain store (no ordering/fences) of an element to a given offset
-
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 bufferoffset
- computed viacalcLongElementOffset(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 bufferoffset
- computed viacalcCircularLongElementOffset(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 bufferoffset
- computed viacalcLongElementOffset(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 bufferoffset
- computed viacalcCircularLongElementOffset(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 indexmask
- (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.
-