5 constexpr
auto array_from_object(
const T& obj) {
6 std::array<unsigned char, sizeof(T)> ret;
7 for (std::size_t i = 0; i <
sizeof(T); ++i) {
8 ret[i] =
reinterpret_cast<const unsigned char*
>(&obj)[i];
16 typename = std::enable_if_t<
17 std::is_pointer<decltype(&*std::declval<it>())>::value
21 constexpr uint32_t FNV32a(it begin, it end) {
22 const uint32_t FNV_32_PRIME = 16777619;
23 uint32_t hval = 2166136261;
24 for (it p = begin; p != end; ++p) {
26 auto repr = array_from_object(*p);
27 for (
auto ch : repr) {
28 hval ^= std::uint32_t{ch};