1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20

base / third_party / cityhash / patches / 0001-bswap-clang.patch [blame]

diff --git a/base/third_party/cityhash/city.cc b/base/third_party/cityhash/city.cc
index b0d2294aabb3..2ab3db20f4fa 100644
--- a/base/third_party/cityhash/city.cc
+++ b/base/third_party/cityhash/city.cc
@@ -35,7 +35,14 @@
 using std::make_pair;
 using std::pair;
 
-#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)