1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
diff --git a/components/esm/formid.hpp b/components/esm/formid.hpp
index e9416e35..9fe89585 100644
--- a/components/esm/formid.hpp
+++ b/components/esm/formid.hpp
@@ -51,10 +51,10 @@ namespace std
{
size_t operator()(const ESM::FormId& formId) const
{
- static_assert(sizeof(ESM::FormId) == sizeof(size_t));
- size_t s;
- memcpy(&s, &formId, sizeof(size_t));
- return hash<size_t>()(s);
+ static_assert(sizeof(ESM::FormId) == sizeof(uint64_t));
+ uint64_t s;
+ memcpy(&s, &formId, sizeof(ESM::FormId));
+ return hash<uint64_t>()(s);
}
};
diff --git a/components/misc/strings/algorithm.hpp b/components/misc/strings/algorithm.hpp
index 18f72104..681bc060 100644
--- a/components/misc/strings/algorithm.hpp
+++ b/components/misc/strings/algorithm.hpp
@@ -4,6 +4,7 @@
#include "lower.hpp"
#include <algorithm>
+#include <cstdint>
#include <functional>
#include <string>
#include <string_view>
@@ -85,17 +86,17 @@ namespace Misc::StringUtils
{
using is_transparent = void;
- constexpr std::size_t operator()(std::string_view str) const
+ std::size_t operator()(std::string_view str) const
{
// FNV-1a
- std::size_t hash{ 0xcbf29ce484222325ull };
- constexpr std::size_t prime{ 0x00000100000001B3ull };
+ std::uint64_t hash{ 0xcbf29ce484222325ull };
+ constexpr std::uint64_t prime{ 0x00000100000001B3ull };
for (char c : str)
{
- hash ^= static_cast<std::size_t>(toLower(c));
+ hash ^= static_cast<std::uint64_t>(toLower(c));
hash *= prime;
}
- return hash;
+ return std::hash<std::uint64_t>()(hash);
}
};
|