GCS
0.2.3
|
#include "gu_int128.h"
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
#include <assert.h>
Go to the source code of this file.
This header file defines FNV hash functions for 3 hash sizes: 4, 8 and 16 bytes.
Be wary of bitshift multiplication "optimization" (FNV_BITSHIFT_OPTIMIZATION): FNV authors used to claim marginal speedup when using it, however on core2 CPU it has shown no speedup for fnv32a and more than 2x slowdown for fnv64a and fnv128a. Disabled by default.
FNV vs. FNVa: FNVa has a better distribution: multiplication happens after XOR and hence propagates XOR effect to all bytes of the hash. Hence by default functions perform FNVa. GU_FNV_NORMAL macro is needed for unit tests.
gu_fnv*_internal() functions are endian-unsafe, their output should be converted to little-endian format if it is to be exported to other machines.
#define GU_FNV128_MUL | ( | _x | ) |