<T> int fetch8(Access<T> access, T in, long off) { return access.getUnsignedByte(in, off); }
<T> int fetch8(Access<T> access, T in, long off) { return access.getUnsignedByte(in, off); }
/** * Shortcut for {@code getShort(input, offset) & 0xFFFF}. Could be implemented more * efficiently. * * @param input the object to access * @param offset offset to the first byte to read within the byte sequence represented * by the given object * @return two bytes as an unsigned short value, in {@linkplain #byteOrder(Object) the expected * order} */ public int getUnsignedShort(T input, long offset) { if (byteOrder(input) == LITTLE_ENDIAN) { return getUnsignedByte(input, offset) | (getUnsignedByte(input, offset + 1L) << 8); } else { return getUnsignedByte(input, offset + 1L) | (getUnsignedByte(input, offset) << 8); } }
switch ((int) remaining) { case 15: k2 ^= ((long) access.getUnsignedByte(input, offset + 14L)) << 48;// fall through case 14: k2 ^= ((long) access.getUnsignedByte(input, offset + 13L)) << 40;// fall through case 13: k2 ^= ((long) access.getUnsignedByte(input, offset + 12L)) << 32;// fall through case 12: k2 ^= ((long) access.getUnsignedByte(input, offset + 11L)) << 24;// fall through case 11: k2 ^= ((long) access.getUnsignedByte(input, offset + 10L)) << 16;// fall through case 10: k2 ^= ((long) access.getUnsignedByte(input, offset + 9L)) << 8; // fall through case 9: k2 ^= ((long) access.getUnsignedByte(input, offset + 8L)); // fall through case 8: k1 ^= fetch64(access, input, offset); break; case 7: k1 ^= ((long) access.getUnsignedByte(input, offset + 6L)) << 48; // fall through case 6: k1 ^= ((long) access.getUnsignedByte(input, offset + 5L)) << 40; // fall through case 5: k1 ^= ((long) access.getUnsignedByte(input, offset + 4L)) << 32; // fall through case 4: k1 ^= Primitives.unsignedInt(fetch32(access, input, offset)); break; case 3: k1 ^= ((long) access.getUnsignedByte(input, offset + 2L)) << 16; // fall through
<T> long hashLen0To16(Access<T> access, T in, long off, long len) { if (len >= 8L) { long a = fetch64(access, in, off); long b = fetch64(access, in, off + len - 8L); return hash8To16Bytes(len, a, b); } else if (len >= 4L) { long a = Primitives.unsignedInt(fetch32(access, in, off)); long b = Primitives.unsignedInt(fetch32(access, in, off + len - 4L)); return hash4To7Bytes(len, a, b); } else if (len > 0L) { int a = access.getUnsignedByte(in, off); int b = access.getUnsignedByte(in, off + (len >> 1)); int c = access.getUnsignedByte(in, off + len - 1L); return hash1To3Bytes((int) len, a, b, c); } return K2; }