xxhash: replace copy_state() wrappers with macros

These simply wraps memcpy().
Replace it with macros so that it is naturally inlined.

Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
Change-Id: I67887a706816aff46339d43b2f28e97813c1d4af
fourteen
Juhyung Park 3 years ago committed by Jenna
parent 3cdd7832ab
commit cacea0659d
  1. 4
      include/linux/xxhash.h
  2. 15
      lib/xxhash.c

@ -223,7 +223,7 @@ uint64_t xxh64_digest(const struct xxh64_state *state);
* @src: The source xxh32 state.
* @dst: The destination xxh32 state.
*/
void xxh32_copy_state(struct xxh32_state *dst, const struct xxh32_state *src);
#define xxh32_copy_state(dst, src) memcpy(dst, src, sizeof(*dst))
/**
* xxh64_copy_state() - copy the source state into the destination state
@ -231,6 +231,6 @@ void xxh32_copy_state(struct xxh32_state *dst, const struct xxh32_state *src);
* @src: The source xxh64 state.
* @dst: The destination xxh64 state.
*/
void xxh64_copy_state(struct xxh64_state *dst, const struct xxh64_state *src);
#define xxh64_copy_state(dst, src) memcpy(dst, src, sizeof(*dst))
#endif /* XXHASH_H */

@ -73,21 +73,6 @@ static const uint64_t PRIME64_3 = 1609587929392839161ULL;
static const uint64_t PRIME64_4 = 9650029242287828579ULL;
static const uint64_t PRIME64_5 = 2870177450012600261ULL;
/*-**************************
* Utils
***************************/
void xxh32_copy_state(struct xxh32_state *dst, const struct xxh32_state *src)
{
memcpy(dst, src, sizeof(*dst));
}
EXPORT_SYMBOL(xxh32_copy_state);
void xxh64_copy_state(struct xxh64_state *dst, const struct xxh64_state *src)
{
memcpy(dst, src, sizeof(*dst));
}
EXPORT_SYMBOL(xxh64_copy_state);
/*-***************************
* Simple Hash Functions
****************************/

Loading…
Cancel
Save