Add convenience typed hash functions
This commit is contained in:
parent
e01fcdcd59
commit
f71f15ebf1
4
hash.hpp
4
hash.hpp
@ -35,7 +35,11 @@ namespace util {
|
|||||||
|
|
||||||
// General hashes for when you really just don't care about implementation
|
// General hashes for when you really just don't care about implementation
|
||||||
inline uint32_t hash (uint32_t key) { return wang32 (key); }
|
inline uint32_t hash (uint32_t key) { return wang32 (key); }
|
||||||
|
inline int32_t hash ( int32_t key) { return (int32_t) hash ((uint32_t)key); }
|
||||||
|
|
||||||
inline uint64_t hash (uint64_t key) { return wang64 (key); }
|
inline uint64_t hash (uint64_t key) { return wang64 (key); }
|
||||||
|
inline int64_t hash ( int64_t key) { return (int64_t) hash ((uint64_t)key); }
|
||||||
|
|
||||||
inline uintptr_t hash (const void *key) {
|
inline uintptr_t hash (const void *key) {
|
||||||
return sizeof (uintptr_t) == 32 ? wang32 (reinterpret_cast<uintptr_t> (key)) :
|
return sizeof (uintptr_t) == 32 ? wang32 (reinterpret_cast<uintptr_t> (key)) :
|
||||||
wang64 (reinterpret_cast<uintptr_t> (key));
|
wang64 (reinterpret_cast<uintptr_t> (key));
|
||||||
|
Loading…
Reference in New Issue
Block a user