Browse files

Update xxhash to r6.

  • Loading branch information...
1 parent da8bef9 commit 5e60edf0d21f3dbcf908a7c5eec08059aa315bf1 @jpountz committed Dec 18, 2012
Showing with 10 additions and 4 deletions.
  1. +1 −1 CHANGES.txt
  2. +2 −2 src/xxhash/xxhash.c
  3. +7 −1 src/xxhash/xxhash.h
@@ -6,4 +6,4 @@ Version 1.0
First release.
Java ports and bindings of LZ4 and xxhash.
LZ4 r85
- xxhash r5
+ xxhash r6
4 src/xxhash/xxhash.c
@@ -98,7 +98,7 @@
#if defined(_MSC_VER) // Visual Studio
# define XXH_swap32 _byteswap_ulong
-#elif GCC_VERSION >= 430
+#elif GCC_VERSION >= 403
# define XXH_swap32 __builtin_bswap32
static inline unsigned int XXH_swap32 (unsigned int x) {
@@ -208,7 +208,7 @@ struct XXH_state32_t
unsigned int v2;
unsigned int v3;
unsigned int v4;
- unsigned int total_len;
+ unsigned long long total_len;
char memory[16];
int memsize;
8 src/xxhash/xxhash.h
@@ -76,6 +76,8 @@ XXH32() :
"seed" can be used to alter the result
This function successfully passes all SMHasher tests.
Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark) : 5.4 GB/s
+ Note that "len" is type "int", which means it is limited to 2^31-1.
+ If your data is larger, use the advanced functions below.
@@ -97,7 +99,11 @@ void* XXH32_init()
The function returns a pointer which holds the state of calculation.
This pointer must be provided as "void* state" parameter for XXH32_feed().
+XXH32_feed() can be called as many times as necessary.
The function returns an error code, with 0 meaning OK, and all other values meaning there is an error.
+Note that "len" is type "int", which means it is limited to 2^31-1.
+If your data is larger, it is recommended
+to chunk your data into blocks of size 2^30 (1GB) to avoid any "int" overflow issue.
Finally, you can end the calculation anytime, by using XXH32_result().
This function returns the final 32-bits hash.
@@ -111,7 +117,7 @@ unsigned int XXH32_getIntermediateResult (void* state);
This function does the same as XXH32_result(), generating a 32-bit hash,
but preserve memory context.
-This way, it becomes possible to generate an intermediate hash, and then continue feeding data with XXH32_feed().
+This way, it becomes possible to generate intermediate hashes, and then continue feeding data with XXH32_feed().
To free memory context, use XXH32_result().

0 comments on commit 5e60edf

Please sign in to comment.