// TJP COPYRIGHT HEADER #pragma once #include namespace tjp { namespace core { u32 hash32(const u8 *begin, size_t size); u64 hash64(const u8 *begin, size_t size); template T hash(const u8 *begin, size_t size); template T hash_of(const U &u) { auto *begin_ = u.data(); auto *end_ = begin_ + u.size(); auto *begin = (u8 *)begin_; auto *end = (u8 *)end_; return hash(begin, (end - begin)); } template T hash_of_value(const U &u) { auto *begin_ = &u; auto *end_ = begin_ + sizeof(u); auto *begin = (u8 *)begin_; auto *end = (u8 *)end_; return hash(begin, (end - begin)); } template<> inline u32 hash(const u8 *begin, size_t size) { return hash32(begin, size); } template<> inline s32 hash(const u8 *begin, size_t size) { return hash32(begin, size); } template<> inline u64 hash(const u8 *begin, size_t size) { return hash64(begin, size); } template<> inline s64 hash(const u8 *begin, size_t size) { return hash64(begin, size); } } // namespace } // namespace