xref: /aosp_15_r20/external/libchrome/libchrome_tools/patch/hash.patch (revision 635a864187cb8b6c713ff48b7e790a6b21769273)
1# libchrome does not support SuperFastHash. Instead use std::hash.
2
3--- a/base/hash.cc
4+++ b/base/hash.cc
5@@ -4,10 +4,12 @@
6
7 #include "base/hash.h"
8
9-// Definition in base/third_party/superfasthash/superfasthash.c. (Third-party
10-// code did not come with its own header file, so declaring the function here.)
11-// Note: This algorithm is also in Blink under Source/wtf/StringHasher.h.
12-extern "C" uint32_t SuperFastHash(const char* data, int len);
13+#include <functional>
14+
15+uint32_t SuperFastHash(const char* data, size_t len) {
16+  std::hash<std::string> hash_fn;
17+  return hash_fn(std::string(data, len));
18+}
19
20 namespace base {
21
22