1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
base / third_party / cityhash_v103 / patches / 005-bswap-clang.patch [blame]
diff --git b/base/third_party/cityhash_v103/src/city_v103.cc a/base/third_party/cityhash_v103/src/city_v103.cc
index b01f42925afe5..e2d276fabf784 100644
--- a/base/third_party/cityhash_v103/src/city_v103.cc
+++ b/base/third_party/cityhash_v103/src/city_v103.cc
@@ -58,7 +58,14 @@ static uint32 UNALIGNED_LOAD32(const char* p) {
#else
-#ifdef _MSC_VER
+#if defined(__clang__)
+
+// Use builtins where possible. On Windows for instance, this may prevent a
+// function call instead of emitting a single instruction.
+#define bswap_32(x) __builtin_bswap32(x)
+#define bswap_64(x) __builtin_bswap64(x)
+
+#elif _MSC_VER
#include <stdlib.h>
#define bswap_32(x) _byteswap_ulong(x)
#define bswap_64(x) _byteswap_uint64(x)