projects
/
folly.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
45bedee
)
folly: Hash: use loadUnassigned to avoid UB in hsieh_hash32_buf (fsanitize=alignment)
author
Lucian Grijincu
<lucian@fb.com>
Mon, 1 Feb 2016 19:51:51 +0000
(11:51 -0800)
committer
facebook-github-bot-1
<folly-bot@fb.com>
Mon, 1 Feb 2016 20:20:30 +0000
(12:20 -0800)
Reviewed By: philippv
Differential Revision:
D2886152
fb-gh-sync-id:
64c3543db831c72c7f4cf307867223270293066e
folly/Hash.h
patch
|
blob
|
history
diff --git
a/folly/Hash.h
b/folly/Hash.h
index 7e44fbb2dec986cedebce4e5e8bf72452338c967..0def3efccb3a2f604fdd176bffca7d2ef6b5461b 100644
(file)
--- a/
folly/Hash.h
+++ b/
folly/Hash.h
@@
-25,6
+25,7
@@
#include <utility>
#include <folly/ApplyTuple.h>
+#include <folly/Bits.h>
#include <folly/SpookyHashV1.h>
#include <folly/SpookyHashV2.h>
@@
-277,7
+278,7
@@
inline uint64_t fnv64(const std::string& str,
* Paul Hsieh: http://www.azillionmonkeys.com/qed/hash.html
*/
-#define get16bits(d)
(*((const uint16_t*) (d))
)
+#define get16bits(d)
folly::loadUnaligned<uint16_t>(d
)
inline uint32_t hsieh_hash32_buf(const void* buf, size_t len) {
// forcing signed char, since other platforms can use unsigned