# HG changeset patch # User Petr Sumbera # Date 1554226076 0 # Node ID 48f0ab684d3facb118a545dd2ca27dfb1394c4cd # Parent b211dc9046496a0fcf13d4fc0c887df441800e43 Bug 1540142 - Avoid SIGBUS on SPARC systems due CityHash64 r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D25442 diff --git a/other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp b/other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp --- a/other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp +++ b/other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp @@ -28,18 +28,33 @@ // compromising on hash quality. #include "city.h" #include using namespace std; +#if __sparc__ +#include +static inline uint64 UNALIGNED_LOAD64(const char *p) { + uint64 val; + memcpy(&val, p, sizeof(uint64)); + return val; +} + +static inline uint32 UNALIGNED_LOAD32(const char *p) { + uint32 val; + memcpy(&val, p, sizeof(uint32)); + return val; +} +#else #define UNALIGNED_LOAD64(p) (*(const uint64*)(p)) #define UNALIGNED_LOAD32(p) (*(const uint32*)(p)) +#endif #if !defined(LIKELY) #if defined(__GNUC__) #define LIKELY(x) (__builtin_expect(!!(x), 1)) #else #define LIKELY(x) (x) #endif #endif