xxhash: inline round() functions

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

Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
Change-Id: Ieee439865dc48f21a97032a8009941331c302227
fourteen
Juhyung Park 3 years ago committed by Jenna
parent cacea0659d
commit e8982c1876
  1. 6
      lib/xxhash.c

@ -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;

Loading…
Cancel
Save