make len8 part of 8to16

This commit is contained in:
Yann Collet 2020-02-19 21:02:00 -08:00
parent 77d65ff45f
commit 5fad59e746

6
xxh3.h
View File

@ -573,7 +573,7 @@ XXH3_len_4to8_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_h
{
XXH_ASSERT(input != NULL);
XXH_ASSERT(secret != NULL);
XXH_ASSERT(4 <= len && len <= 8);
XXH_ASSERT(4 <= len && len < 8);
seed = XXH_rotl64(seed, 13);
{ xxh_u32 const input1 = XXH_readLE32(input);
xxh_u32 const input2 = XXH_readLE32(input + len - 4);
@ -592,7 +592,7 @@ XXH3_len_9to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_
{
XXH_ASSERT(input != NULL);
XXH_ASSERT(secret != NULL);
XXH_ASSERT(8 < len && len <= 16);
XXH_ASSERT(8 <= len && len <= 16);
{ xxh_u64 const input_lo = XXH_readLE64(input) ^ XXH_readLE64(secret);
xxh_u64 const input_hi = XXH_readLE64(input + len - 8) ^ (XXH_readLE64(secret + 8) - seed);
xxh_u64 const acc = len + (input_lo + input_hi) + XXH3_mul128_fold64(input_lo, input_hi);
@ -604,7 +604,7 @@ XXH_FORCE_INLINE XXH64_hash_t
XXH3_len_0to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed)
{
XXH_ASSERT(len <= 16);
{ if (XXH_likely(len > 8)) return XXH3_len_9to16_64b(input, len, secret, seed);
{ if (XXH_likely(len >= 8)) return XXH3_len_9to16_64b(input, len, secret, seed);
if (XXH_likely(len >= 4)) return XXH3_len_4to8_64b(input, len, secret, seed);
if (len) return XXH3_len_1to3_64b(input, len, secret, seed);
return XXH3_avalanche((PRIME64_1 + seed) ^ XXH_readLE64(secret));