diff --git a/kmod/src/hash.h b/kmod/src/hash.h new file mode 100644 index 00000000..3ad3de09 --- /dev/null +++ b/kmod/src/hash.h @@ -0,0 +1,15 @@ +#ifndef _SCOUTFS_HASH_H_ +#define _SCOUTFS_HASH_H_ + +#include + +/* XXX replace with xxhash */ +static inline u64 scoutfs_hash64(const void *data, unsigned int len) +{ + unsigned int half = (len + 1) / 2; + + return crc32c(~0, data, half) | + ((u64)crc32c(~0, data + len - half, half) << 32); +} + +#endif