csnip  0.1
hash.h
Go to the documentation of this file.
1 #ifndef CSNIP_HASH_H
2 #define CSNIP_HASH_H
3 
22 #include <stdint.h>
23 #include <stddef.h>
24 
26 #define CSNIP_FNV32_INIT ((uint32_t)0x811C9DC5ul)
27 
58 uint32_t csnip_hash_fnv32_b(const void* buf, size_t sz, uint32_t h0);
59 
74 uint32_t csnip_hash_fnv32_s(const char* str, uint32_t h0);
75 
77 #define CSNIP_FNV64_INIT ((uint64_t)0xCBF29CE484222325ull)
78 
94 uint64_t csnip_hash_fnv64_b(const void* buf, size_t sz, uint64_t h0);
95 
108 uint64_t csnip_hash_fnv64_s(const char* str, uint64_t h0);
109 
112 #endif /* CSNIP_HASH_H */
113 
114 #if defined(CSNIP_SHORT_NAMES) && !defined(CSNIP_HASH_HAVE_SHORT_NAMES)
115 #define FNV32_INIT CSNIP_FNV32_INIT
116 #define FNV64_INIT CSNIP_FNV64_INIT
117 #define hash_fnv32_b csnip_hash_fnv32_b
118 #define hash_fnv32_s csnip_hash_fnv32_s
119 #define hash_fnv64_b csnip_hash_fnv64_b
120 #define hash_fnv64_s csnip_hash_fnv64_s
121 #define CSNIP_HASH_HAVE_SHORT_NAMES
122 #endif /* CSNIP_SHORT_NAMES && !CSNIP_HASH_HAVE_SHORT_NAMES */
123 
uint32_t csnip_hash_fnv32_b(const void *buf, size_t sz, uint32_t h0)
Compute FNV32 hash.
Definition: fnv_hash.c:28
uint32_t csnip_hash_fnv32_s(const char *str, uint32_t h0)
Compute FNV32 hash.
Definition: fnv_hash.c:34
uint64_t csnip_hash_fnv64_s(const char *str, uint64_t h0)
Compute FNV64 hash.
Definition: fnv_hash.c:46
uint64_t csnip_hash_fnv64_b(const void *buf, size_t sz, uint64_t h0)
Compute FNV64 hash.
Definition: fnv_hash.c:40