/** * Store 8 bytes into the provided array at the indicated offset, using the value provided. * * @param sink the output byte array * @param offset the offset into the array at which to start writing * @param value the value to write */ static void store64(byte[] sink, int offset, long value) { // We don't want to assert in production code. assert offset >= 0 && offset + 8 <= sink.length; // Delegates to the fast (unsafe)version or the fallback. byteArray.putLongLittleEndian(sink, offset, value); }
/** * Load 8 bytes into long in a little endian manner, from the substring between position and * position + 8. The array must have at least 8 bytes from offset (inclusive). * * @param input the input bytes * @param offset the offset into the array at which to start * @return a long of a concatenated 8 bytes */ static long load64(byte[] input, int offset) { // We don't want this in production code as this is the most critical part of the loop. assert input.length >= offset + 8; // Delegates to the fast (unsafe) version or the fallback. return byteArray.getLongLittleEndian(input, offset); }