memory hash workaround
This commit is contained in:
@@ -85,6 +85,7 @@ add_library(leanclr_godot SHARED
|
||||
src/leanclr_script_language.cpp
|
||||
src/leanclr_script_loader.cpp
|
||||
src/leanclr_script_saver.cpp
|
||||
src/leanclr_wasm_libcxx_shim.cpp
|
||||
src/register_types.cpp
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#include <cstddef>
|
||||
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
extern "C" std::size_t leanclr_godot_libcxx_hash_memory(const void* p_data, std::size_t p_size) noexcept
|
||||
__asm__("_ZNSt3__213__hash_memoryEPKvm");
|
||||
|
||||
extern "C" std::size_t leanclr_godot_libcxx_hash_memory(const void* p_data, std::size_t p_size) noexcept
|
||||
{
|
||||
const unsigned char* bytes = static_cast<const unsigned char*>(p_data);
|
||||
std::size_t hash = 1469598103934665603ull;
|
||||
for (std::size_t i = 0; i < p_size; ++i)
|
||||
{
|
||||
hash ^= bytes[i];
|
||||
hash *= 1099511628211ull;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user