xxhash: Inline round() functions

xxhash's performance depends heavily on compiler optimizations including
inlines. Follow upstream's behavior and inline those helper functions.

Change-Id: I1bc08b7ef6a491817b9ed5e8daab0f1993081f71
Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Juhyung Park 2021-10-03 17:27:23 +09:00 committed by Richard Raya
parent 8a0a4124ea
commit a74d78d29f

View File

@ -76,7 +76,7 @@ static const uint64_t PRIME64_5 = 2870177450012600261ULL;
/*-***************************
* Simple Hash Functions
****************************/
static uint32_t xxh32_round(uint32_t seed, const uint32_t input)
static inline uint32_t xxh32_round(uint32_t seed, const uint32_t input)
{
seed += input * PRIME32_2;
seed = xxh_rotl32(seed, 13);
@ -138,7 +138,7 @@ uint32_t xxh32(const void *input, const size_t len, const uint32_t seed)
}
EXPORT_SYMBOL(xxh32);
static uint64_t xxh64_round(uint64_t acc, const uint64_t input)
static inline uint64_t xxh64_round(uint64_t acc, const uint64_t input)
{
acc += input * PRIME64_2;
acc = xxh_rotl64(acc, 31);
@ -146,7 +146,7 @@ static uint64_t xxh64_round(uint64_t acc, const uint64_t input)
return acc;
}
static uint64_t xxh64_merge_round(uint64_t acc, uint64_t val)
static inline uint64_t xxh64_merge_round(uint64_t acc, uint64_t val)
{
val = xxh64_round(0, val);
acc ^= val;