3 #ifndef GEODE_CACHEABLEKEYS_H_
4 #define GEODE_CACHEABLEKEYS_H_
23 #include "geode_globals.hpp"
28 namespace serializer {
30 template <
typename TObj>
31 inline bool equals(
const TObj& x,
const TObj& y) {
35 inline uint32_t hashcode(
const bool value) {
43 inline uint32_t hashcode(
const uint8_t value) {
44 return static_cast<uint32_t>(value);
47 inline uint32_t hashcode(
const int8_t value) {
48 return static_cast<uint32_t>(value);
51 inline uint32_t hashcode(
const uint16_t value) {
52 return static_cast<uint32_t>(value);
55 inline uint32_t hashcode(
const int16_t value) {
56 return static_cast<uint32_t>(value);
59 inline uint32_t hashcode(
const uint32_t value) {
return value; }
61 inline uint32_t hashcode(
const int32_t value) {
62 return static_cast<uint32_t>(value);
65 inline uint32_t hashcode(
const uint64_t value) {
66 uint32_t hash = static_cast<uint32_t>(value);
67 hash = hash ^ static_cast<uint32_t>(value >> 32);
71 inline uint32_t hashcode(
const int64_t value) {
72 uint32_t hash = static_cast<uint32_t>(value);
73 hash = hash ^ static_cast<uint32_t>(value >> 32);
77 inline uint32_t hashcode(
const float value) {
78 union float_uint32_t {
86 inline uint32_t hashcode(
const double value) {
87 union double_uint64_t {
99 #endif // GEODE_CACHEABLEKEYS_H_