xref: /aosp_15_r20/external/cronet/base/third_party/cityhash/patches/0001-bswap-clang.patch (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1diff --git a/base/third_party/cityhash/city.cc b/base/third_party/cityhash/city.cc
2index b0d2294aabb3..2ab3db20f4fa 100644
3--- a/base/third_party/cityhash/city.cc
4+++ b/base/third_party/cityhash/city.cc
5@@ -35,7 +35,14 @@
6 using std::make_pair;
7 using std::pair;
8
9-#ifdef _MSC_VER
10+#if defined(__clang__)
11+
12+// Use builtins where possible. On Windows for instance, this may prevent a
13+// function call instead of emitting a single instruction.
14+#define bswap_32(x) __builtin_bswap32(x)
15+#define bswap_64(x) __builtin_bswap64(x)
16+
17+#elif _MSC_VER
18
19 #include <stdlib.h>
20 #define bswap_32(x) _byteswap_ulong(x)
21