Skip to content

Commit

Permalink
feat(xxhash) update to 0.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Spasi committed Jan 4, 2025
1 parent ef574f3 commit 20e3ac8
Show file tree
Hide file tree
Showing 10 changed files with 1,017 additions and 568 deletions.
1 change: 1 addition & 0 deletions doc/notes/3.3.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This build includes the following changes:

- vma: Updated to 3.2.0 (up from 3.1.0)
- Vulkan: Updated to 1.4.304 (up from 1.4.303)
- xxhash: Updated to 0.8.3 (up from 0.8.2)

#### Improvements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
* struct XXH32_state_t {
* XXH32_hash_t {@link #total_len_32};
* XXH32_hash_t {@link #large_len};
* XXH32_hash_t {@link #v}[4];
* XXH32_hash_t {@link #mem32}[4];
* XXH32_hash_t {@link #memsize};
* XXH32_hash_t {@link #acc}[4];
* unsigned char {@link #buffer}[16];
* XXH32_hash_t {@link #bufferedSize};
* XXH32_hash_t {@link #reserved};
* }</code></pre>
*/
Expand All @@ -44,17 +44,17 @@ public class XXH32State extends Struct<XXH32State> implements NativeResource {
public static final int
TOTAL_LEN_32,
LARGE_LEN,
V,
MEM32,
MEMSIZE,
ACC,
BUFFER,
BUFFEREDSIZE,
RESERVED;

static {
Layout layout = __struct(
__member(4),
__member(4),
__array(4, 4),
__array(4, 4),
__array(1, 16),
__member(4),
__member(4)
);
Expand All @@ -64,9 +64,9 @@ public class XXH32State extends Struct<XXH32State> implements NativeResource {

TOTAL_LEN_32 = layout.offsetof(0);
LARGE_LEN = layout.offsetof(1);
V = layout.offsetof(2);
MEM32 = layout.offsetof(3);
MEMSIZE = layout.offsetof(4);
ACC = layout.offsetof(2);
BUFFER = layout.offsetof(3);
BUFFEREDSIZE = layout.offsetof(4);
RESERVED = layout.offsetof(5);
}

Expand Down Expand Up @@ -100,19 +100,19 @@ public XXH32State(ByteBuffer container) {
public int large_len() { return nlarge_len(address()); }
/** accumulator lanes */
@NativeType("XXH32_hash_t[4]")
public IntBuffer v() { return nv(address()); }
public IntBuffer acc() { return nacc(address()); }
/** accumulator lanes */
@NativeType("XXH32_hash_t")
public int v(int index) { return nv(address(), index); }
/** internal buffer for partial reads. Treated as {@code unsigned char[16]}. */
@NativeType("XXH32_hash_t[4]")
public IntBuffer mem32() { return nmem32(address()); }
/** internal buffer for partial reads. Treated as {@code unsigned char[16]}. */
@NativeType("XXH32_hash_t")
public int mem32(int index) { return nmem32(address(), index); }
/** amount of data in {@code mem32} */
public int acc(int index) { return nacc(address(), index); }
/** internal buffer for partial reads */
@NativeType("unsigned char[16]")
public ByteBuffer buffer() { return nbuffer(address()); }
/** internal buffer for partial reads */
@NativeType("unsigned char")
public byte buffer(int index) { return nbuffer(address(), index); }
/** amount of data in {@code buffer} */
@NativeType("XXH32_hash_t")
public int memsize() { return nmemsize(address()); }
public int bufferedSize() { return nbufferedSize(address()); }
/** reserved field. Do not read nor write to it. */
@NativeType("XXH32_hash_t")
public int reserved() { return nreserved(address()); }
Expand Down Expand Up @@ -251,20 +251,20 @@ public static XXH32State.Buffer calloc(int capacity, MemoryStack stack) {
public static int ntotal_len_32(long struct) { return memGetInt(struct + XXH32State.TOTAL_LEN_32); }
/** Unsafe version of {@link #large_len}. */
public static int nlarge_len(long struct) { return memGetInt(struct + XXH32State.LARGE_LEN); }
/** Unsafe version of {@link #v}. */
public static IntBuffer nv(long struct) { return memIntBuffer(struct + XXH32State.V, 4); }
/** Unsafe version of {@link #v(int) v}. */
public static int nv(long struct, int index) {
return memGetInt(struct + XXH32State.V + check(index, 4) * 4);
/** Unsafe version of {@link #acc}. */
public static IntBuffer nacc(long struct) { return memIntBuffer(struct + XXH32State.ACC, 4); }
/** Unsafe version of {@link #acc(int) acc}. */
public static int nacc(long struct, int index) {
return memGetInt(struct + XXH32State.ACC + check(index, 4) * 4);
}
/** Unsafe version of {@link #mem32}. */
public static IntBuffer nmem32(long struct) { return memIntBuffer(struct + XXH32State.MEM32, 4); }
/** Unsafe version of {@link #mem32(int) mem32}. */
public static int nmem32(long struct, int index) {
return memGetInt(struct + XXH32State.MEM32 + check(index, 4) * 4);
/** Unsafe version of {@link #buffer}. */
public static ByteBuffer nbuffer(long struct) { return memByteBuffer(struct + XXH32State.BUFFER, 16); }
/** Unsafe version of {@link #buffer(int) buffer}. */
public static byte nbuffer(long struct, int index) {
return memGetByte(struct + XXH32State.BUFFER + check(index, 16) * 1);
}
/** Unsafe version of {@link #memsize}. */
public static int nmemsize(long struct) { return memGetInt(struct + XXH32State.MEMSIZE); }
/** Unsafe version of {@link #bufferedSize}. */
public static int nbufferedSize(long struct) { return memGetInt(struct + XXH32State.BUFFEREDSIZE); }
/** Unsafe version of {@link #reserved}. */
public static int nreserved(long struct) { return memGetInt(struct + XXH32State.RESERVED); }

Expand Down Expand Up @@ -317,21 +317,21 @@ protected XXH32State getElementFactory() {
/** @return the value of the {@link XXH32State#large_len} field. */
@NativeType("XXH32_hash_t")
public int large_len() { return XXH32State.nlarge_len(address()); }
/** @return a {@link IntBuffer} view of the {@link XXH32State#v} field. */
@NativeType("XXH32_hash_t[4]")
public IntBuffer v() { return XXH32State.nv(address()); }
/** @return the value at the specified index of the {@link XXH32State#v} field. */
@NativeType("XXH32_hash_t")
public int v(int index) { return XXH32State.nv(address(), index); }
/** @return a {@link IntBuffer} view of the {@link XXH32State#mem32} field. */
/** @return a {@link IntBuffer} view of the {@link XXH32State#acc} field. */
@NativeType("XXH32_hash_t[4]")
public IntBuffer mem32() { return XXH32State.nmem32(address()); }
/** @return the value at the specified index of the {@link XXH32State#mem32} field. */
public IntBuffer acc() { return XXH32State.nacc(address()); }
/** @return the value at the specified index of the {@link XXH32State#acc} field. */
@NativeType("XXH32_hash_t")
public int mem32(int index) { return XXH32State.nmem32(address(), index); }
/** @return the value of the {@link XXH32State#memsize} field. */
public int acc(int index) { return XXH32State.nacc(address(), index); }
/** @return a {@link ByteBuffer} view of the {@link XXH32State#buffer} field. */
@NativeType("unsigned char[16]")
public ByteBuffer buffer() { return XXH32State.nbuffer(address()); }
/** @return the value at the specified index of the {@link XXH32State#buffer} field. */
@NativeType("unsigned char")
public byte buffer(int index) { return XXH32State.nbuffer(address(), index); }
/** @return the value of the {@link XXH32State#bufferedSize} field. */
@NativeType("XXH32_hash_t")
public int memsize() { return XXH32State.nmemsize(address()); }
public int bufferedSize() { return XXH32State.nbufferedSize(address()); }
/** @return the value of the {@link XXH32State#reserved} field. */
@NativeType("XXH32_hash_t")
public int reserved() { return XXH32State.nreserved(address()); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
* <pre><code>
* struct XXH64_state_t {
* XXH64_hash_t {@link #total_len};
* XXH64_hash_t {@link #v}[4];
* XXH64_hash_t {@link #mem64}[4];
* XXH32_hash_t {@link #memsize};
* XXH64_hash_t {@link #acc}[4];
* unsigned char {@link #buffer}[32];
* XXH32_hash_t {@link #bufferedSize};
* XXH32_hash_t {@link #reserved32};
* XXH64_hash_t {@link #reserved64};
* }</code></pre>
Expand All @@ -43,17 +43,17 @@ public class XXH64State extends Struct<XXH64State> implements NativeResource {
/** The struct member offsets. */
public static final int
TOTAL_LEN,
V,
MEM64,
MEMSIZE,
ACC,
BUFFER,
BUFFEREDSIZE,
RESERVED32,
RESERVED64;

static {
Layout layout = __struct(
__member(8),
__array(8, 4),
__array(8, 4),
__array(1, 32),
__member(4),
__member(4),
__member(8)
Expand All @@ -63,9 +63,9 @@ public class XXH64State extends Struct<XXH64State> implements NativeResource {
ALIGNOF = layout.getAlignment();

TOTAL_LEN = layout.offsetof(0);
V = layout.offsetof(1);
MEM64 = layout.offsetof(2);
MEMSIZE = layout.offsetof(3);
ACC = layout.offsetof(1);
BUFFER = layout.offsetof(2);
BUFFEREDSIZE = layout.offsetof(3);
RESERVED32 = layout.offsetof(4);
RESERVED64 = layout.offsetof(5);
}
Expand Down Expand Up @@ -97,19 +97,19 @@ public XXH64State(ByteBuffer container) {
public long total_len() { return ntotal_len(address()); }
/** accumulator lanes */
@NativeType("XXH64_hash_t[4]")
public LongBuffer v() { return nv(address()); }
public LongBuffer acc() { return nacc(address()); }
/** accumulator lanes */
@NativeType("XXH64_hash_t")
public long v(int index) { return nv(address(), index); }
/** internal buffer for partial reads. Treated as {@code unsigned char[32]}. */
@NativeType("XXH64_hash_t[4]")
public LongBuffer mem64() { return nmem64(address()); }
/** internal buffer for partial reads. Treated as {@code unsigned char[32]}. */
@NativeType("XXH64_hash_t")
public long mem64(int index) { return nmem64(address(), index); }
/** amount of data in {@code mem64} */
public long acc(int index) { return nacc(address(), index); }
/** internal buffer for partial reads */
@NativeType("unsigned char[32]")
public ByteBuffer buffer() { return nbuffer(address()); }
/** internal buffer for partial reads */
@NativeType("unsigned char")
public byte buffer(int index) { return nbuffer(address(), index); }
/** amount of data in {@code buffer} */
@NativeType("XXH32_hash_t")
public int memsize() { return nmemsize(address()); }
public int bufferedSize() { return nbufferedSize(address()); }
/** reserved field, needed for padding anyways */
@NativeType("XXH32_hash_t")
public int reserved32() { return nreserved32(address()); }
Expand Down Expand Up @@ -249,20 +249,20 @@ public static XXH64State.Buffer calloc(int capacity, MemoryStack stack) {

/** Unsafe version of {@link #total_len}. */
public static long ntotal_len(long struct) { return memGetLong(struct + XXH64State.TOTAL_LEN); }
/** Unsafe version of {@link #v}. */
public static LongBuffer nv(long struct) { return memLongBuffer(struct + XXH64State.V, 4); }
/** Unsafe version of {@link #v(int) v}. */
public static long nv(long struct, int index) {
return memGetLong(struct + XXH64State.V + check(index, 4) * 8);
/** Unsafe version of {@link #acc}. */
public static LongBuffer nacc(long struct) { return memLongBuffer(struct + XXH64State.ACC, 4); }
/** Unsafe version of {@link #acc(int) acc}. */
public static long nacc(long struct, int index) {
return memGetLong(struct + XXH64State.ACC + check(index, 4) * 8);
}
/** Unsafe version of {@link #mem64}. */
public static LongBuffer nmem64(long struct) { return memLongBuffer(struct + XXH64State.MEM64, 4); }
/** Unsafe version of {@link #mem64(int) mem64}. */
public static long nmem64(long struct, int index) {
return memGetLong(struct + XXH64State.MEM64 + check(index, 4) * 8);
/** Unsafe version of {@link #buffer}. */
public static ByteBuffer nbuffer(long struct) { return memByteBuffer(struct + XXH64State.BUFFER, 32); }
/** Unsafe version of {@link #buffer(int) buffer}. */
public static byte nbuffer(long struct, int index) {
return memGetByte(struct + XXH64State.BUFFER + check(index, 32) * 1);
}
/** Unsafe version of {@link #memsize}. */
public static int nmemsize(long struct) { return memGetInt(struct + XXH64State.MEMSIZE); }
/** Unsafe version of {@link #bufferedSize}. */
public static int nbufferedSize(long struct) { return memGetInt(struct + XXH64State.BUFFEREDSIZE); }
/** Unsafe version of {@link #reserved32}. */
public static int nreserved32(long struct) { return memGetInt(struct + XXH64State.RESERVED32); }
/** Unsafe version of {@link #reserved64}. */
Expand Down Expand Up @@ -314,21 +314,21 @@ protected XXH64State getElementFactory() {
/** @return the value of the {@link XXH64State#total_len} field. */
@NativeType("XXH64_hash_t")
public long total_len() { return XXH64State.ntotal_len(address()); }
/** @return a {@link LongBuffer} view of the {@link XXH64State#v} field. */
@NativeType("XXH64_hash_t[4]")
public LongBuffer v() { return XXH64State.nv(address()); }
/** @return the value at the specified index of the {@link XXH64State#v} field. */
@NativeType("XXH64_hash_t")
public long v(int index) { return XXH64State.nv(address(), index); }
/** @return a {@link LongBuffer} view of the {@link XXH64State#mem64} field. */
/** @return a {@link LongBuffer} view of the {@link XXH64State#acc} field. */
@NativeType("XXH64_hash_t[4]")
public LongBuffer mem64() { return XXH64State.nmem64(address()); }
/** @return the value at the specified index of the {@link XXH64State#mem64} field. */
public LongBuffer acc() { return XXH64State.nacc(address()); }
/** @return the value at the specified index of the {@link XXH64State#acc} field. */
@NativeType("XXH64_hash_t")
public long mem64(int index) { return XXH64State.nmem64(address(), index); }
/** @return the value of the {@link XXH64State#memsize} field. */
public long acc(int index) { return XXH64State.nacc(address(), index); }
/** @return a {@link ByteBuffer} view of the {@link XXH64State#buffer} field. */
@NativeType("unsigned char[32]")
public ByteBuffer buffer() { return XXH64State.nbuffer(address()); }
/** @return the value at the specified index of the {@link XXH64State#buffer} field. */
@NativeType("unsigned char")
public byte buffer(int index) { return XXH64State.nbuffer(address(), index); }
/** @return the value of the {@link XXH64State#bufferedSize} field. */
@NativeType("XXH32_hash_t")
public int memsize() { return XXH64State.nmemsize(address()); }
public int bufferedSize() { return XXH64State.nbufferedSize(address()); }
/** @return the value of the {@link XXH64State#reserved32} field. */
@NativeType("XXH32_hash_t")
public int reserved32() { return XXH64State.nreserved32(address()); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public class XXHash {
public static final int XXH_VERSION_MINOR = 8;

/** The release version number. */
public static final int XXH_VERSION_RELEASE = 2;
public static final int XXH_VERSION_RELEASE = 3;

/** The version number */
public static final int XXH_VERSION_NUMBER = (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE);
Expand All @@ -183,6 +183,9 @@ public class XXHash {
*/
public static final int XXH3_SECRET_DEFAULT_SIZE = 192;

/** Maximum size of "short" key in bytes. */
public static final int XXH3_MIDSIZE_MAX = 240;

protected XXHash() {
throw new UnsupportedOperationException();
}
Expand All @@ -199,8 +202,6 @@ protected XXHash() {
/**
* Calculates the 32-bit hash of {@code input} using xxHash32.
*
* <p>Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark): 5.4 GB/s</p>
*
* <p>The memory between {@code input} and {@code input + length} must be valid, readable, contiguous memory. However, if {@code length} is {@code 0},
* {@code input} may be {@code NULL}.</p>
*
Expand Down
Loading

0 comments on commit 20e3ac8

Please sign in to comment.