mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-12 14:01:15 -04:00
Merge branch '32bitfixes' into 'master'
fix 32bit builds. closes #8625 Closes #8625 See merge request OpenMW/openmw!4791
This commit is contained in:
commit
c71448359b
@ -51,10 +51,10 @@ namespace std
|
|||||||
{
|
{
|
||||||
size_t operator()(const ESM::FormId& formId) const
|
size_t operator()(const ESM::FormId& formId) const
|
||||||
{
|
{
|
||||||
static_assert(sizeof(ESM::FormId) == sizeof(size_t));
|
static_assert(sizeof(ESM::FormId) == sizeof(uint64_t));
|
||||||
size_t s;
|
uint64_t s;
|
||||||
memcpy(&s, &formId, sizeof(size_t));
|
memcpy(&s, &formId, sizeof(ESM::FormId));
|
||||||
return hash<size_t>()(s);
|
return hash<uint64_t>()(s);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "lower.hpp"
|
#include "lower.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cstdint>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
@ -85,17 +86,17 @@ namespace Misc::StringUtils
|
|||||||
{
|
{
|
||||||
using is_transparent = void;
|
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
|
// FNV-1a
|
||||||
std::size_t hash{ 0xcbf29ce484222325ull };
|
std::uint64_t hash{ 0xcbf29ce484222325ull };
|
||||||
constexpr std::size_t prime{ 0x00000100000001B3ull };
|
constexpr std::uint64_t prime{ 0x00000100000001B3ull };
|
||||||
for (char c : str)
|
for (char c : str)
|
||||||
{
|
{
|
||||||
hash ^= static_cast<std::size_t>(toLower(c));
|
hash ^= static_cast<std::uint64_t>(toLower(c));
|
||||||
hash *= prime;
|
hash *= prime;
|
||||||
}
|
}
|
||||||
return hash;
|
return std::hash<std::uint64_t>()(hash);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user