Add project files.
This commit is contained in:
19
espReader/msh.h
Normal file
19
espReader/msh.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define CAT2(x, y) x##y
|
||||
#define CAT(x, y) CAT2(x, y)
|
||||
|
||||
// hashes in universally into l (<= num bits in TYPE) bits using odd seed
|
||||
#define MSH(TYPE) \
|
||||
inline TYPE CAT(TYPE, _msh) (TYPE in, TYPE bits, TYPE seed) { \
|
||||
return (seed * in) >> ((sizeof( TYPE ) * 8) - bits); \
|
||||
}
|
||||
|
||||
// hashes for all of the standard sizes
|
||||
MSH(uint8_t)
|
||||
MSH(uint16_t)
|
||||
MSH(uint32_t)
|
||||
MSH(uint64_t)
|
||||
|
||||
Reference in New Issue
Block a user