protected void acceptNewBytesStore(@NotNull final BytesStore bytes) { if (this.bytes != null) { this.bytes.release(); } this.bytes = bytes.bytesStore(); this.bytes.reserve(); }
static long hash(@NotNull BytesStore b, long length) { return b.isDirectMemory() && b.bytesStore() instanceof NativeBytesStore ? OptimisedBytesStoreHash.INSTANCE.applyAsLong(b, length) : VanillaBytesStoreHash.INSTANCE.applyAsLong(b, length); }
static long hash(@NotNull BytesStore b) { return b.isDirectMemory() && b.bytesStore() instanceof NativeBytesStore ? OptimisedBytesStoreHash.INSTANCE.applyAsLong(b) : VanillaBytesStoreHash.INSTANCE.applyAsLong(b); }
static long applyAsLong9to16(@NotNull BytesStore store, int remaining) { @NotNull final NativeBytesStore bytesStore = (NativeBytesStore) store.bytesStore(); final long address = bytesStore.addressForRead(store.readPosition()); long h0 = (long) remaining * K0; int left = remaining; long addrI = address; long l0 = readIncompleteLong(addrI, left); int l0a = (int) (l0 >> 32); long l1 = readIncompleteLong(addrI + 8, left - 8); int l1a = (int) (l1 >> 32); final long l2 = 0; final int l2a = 0; final long l3 = 0; final int l3a = 0; h0 += (l0 + l1a - l2a) * M0; long h1 = (l1 + l2a - l3a) * M1; long h2 = (l2 + l3a - l0a) * M2; long h3 = (l3 + l0a - l1a) * M3; return agitate(h0) ^ agitate(h1) ^ agitate(h2) ^ agitate(h3); }
static long applyAsLong17to32(@NotNull BytesStore store, int remaining) { @NotNull final NativeBytesStore bytesStore = (NativeBytesStore) store.bytesStore(); final long address = bytesStore.addressForRead(store.readPosition()); long h0 = (long) remaining * K0; int left = remaining; long addrI = address; long l0 = MEMORY.readLong(addrI); int l0a = MEMORY.readInt(addrI + TOP_BYTES); long l1 = MEMORY.readLong(addrI + 8); int l1a = MEMORY.readInt(addrI + 8 + TOP_BYTES); long l2 = readIncompleteLong(addrI + 16, left - 16); int l2a = (int) (l2 >> 32); long l3 = readIncompleteLong(addrI + 24, left - 24); int l3a = (int) (l3 >> 32); h0 += (l0 + l1a - l2a) * M0; long h1 = (l1 + l2a - l3a) * M1; long h2 = (l2 + l3a - l0a) * M2; long h3 = (l3 + l0a - l1a) * M3; return agitate(h0) ^ agitate(h1) ^ agitate(h2) ^ agitate(h3); }
public static boolean equalBytesAny(@org.jetbrains.annotations.NotNull @NotNull BytesStore b1, @org.jetbrains.annotations.NotNull @NotNull BytesStore b2, long readRemaining) throws BufferUnderflowException { @org.jetbrains.annotations.Nullable BytesStore bs1 = b1.bytesStore(); @org.jetbrains.annotations.Nullable BytesStore bs2 = b2.bytesStore(); long i = 0; for (; i < readRemaining - 7 &&
public static long applyAsLong32bytesMultiple(@NotNull BytesStore store, int remaining) { @NotNull final NativeBytesStore bytesStore = (NativeBytesStore) store.bytesStore(); final long address = bytesStore.addressForRead(store.readPosition()); long h0 = remaining * K0, h1 = 0, h2 = 0, h3 = 0; int i; for (i = 0; i < remaining - 31; i += 32) { if (i > 0) { h0 *= K0; h1 *= K1; h2 *= K2; h3 *= K3; } long addrI = address + i; long l0 = MEMORY.readLong(addrI); int l0a = MEMORY.readInt(addrI + TOP_BYTES); long l1 = MEMORY.readLong(addrI + 8); int l1a = MEMORY.readInt(addrI + 8 + TOP_BYTES); long l2 = MEMORY.readLong(addrI + 16); int l2a = MEMORY.readInt(addrI + 16 + TOP_BYTES); long l3 = MEMORY.readLong(addrI + 24); int l3a = MEMORY.readInt(addrI + 24 + TOP_BYTES); h0 += (l0 + l1a - l2a) * M0; h1 += (l1 + l2a - l3a) * M1; h2 += (l2 + l3a - l0a) * M2; h3 += (l3 + l0a - l1a) * M3; } return agitate(h0) ^ agitate(h1) ^ agitate(h2) ^ agitate(h3); }
public static long applyAsLongAny(@NotNull BytesStore store, long remaining) { @NotNull final NativeBytesStore bytesStore = (NativeBytesStore) store.bytesStore(); final long address = bytesStore.addressForRead(store.readPosition()); long h0 = remaining * K0, h1 = 0, h2 = 0, h3 = 0;