#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)

