diff options
Diffstat (limited to 'rapidjsonwrapper.h')
| -rw-r--r-- | rapidjsonwrapper.h | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/rapidjsonwrapper.h b/rapidjsonwrapper.h index dfc1fde9..e12465d6 100644 --- a/rapidjsonwrapper.h +++ b/rapidjsonwrapper.h @@ -106,29 +106,27 @@ static inline uint64_t HashRapidValue(const rapidjson::Value& val) } case rapidjson::kNumberType: { - size_t h; - if (val.IsDouble()) + if (val.IsInt64()) { - const double dVal = val.GetDouble(); - h = HashBytes(&dVal, sizeof(dVal)); + return combine(type, static_cast<size_t>(val.GetInt64())); } - else if (val.IsInt()) + else if (val.IsUint64()) { - h = static_cast<size_t>(val.GetInt()); + return combine(type, val.GetUint64()); } - else if (val.IsInt64()) + else if (val.IsUint()) { - h = static_cast<size_t>(val.GetUint64()); + return combine(type, static_cast<size_t>(val.GetUint())); } - else if (val.IsUint()) + else if (val.IsInt()) { - h = static_cast<size_t>(val.GetUint()); + return combine(type, static_cast<size_t>(val.GetInt())); } else { - h = val.GetUint64(); + const double dVal = val.GetDouble(); + return combine(type, HashBytes(&dVal, sizeof(dVal))); } - return combine(type, h); } default: |
