diff options
author | Adam Cozzette <acozzette@gmail.com> | 2017-03-28 13:54:50 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-28 13:54:50 -0700 |
commit | 585993201aaed07d50ea0478a5e2257a72370ac9 (patch) | |
tree | 13f24bb2c6c5e72d33432c4961d35fded4753bf7 | |
parent | b3f3e123aade1550f3d862d742ab26192cd3b786 (diff) | |
parent | f316375a9531241c73988c9b56aa05f4ac8c5261 (diff) | |
download | protobuf-585993201aaed07d50ea0478a5e2257a72370ac9.tar.gz protobuf-585993201aaed07d50ea0478a5e2257a72370ac9.tar.bz2 protobuf-585993201aaed07d50ea0478a5e2257a72370ac9.zip |
Merge pull request #2914 from acozzette/nacl
Added a workaround to allow building for NaCl
-rw-r--r-- | src/google/protobuf/stubs/port.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h index 6f0633c4..6ec5e001 100644 --- a/src/google/protobuf/stubs/port.h +++ b/src/google/protobuf/stubs/port.h @@ -44,6 +44,8 @@ #include <stdint.h> #endif +#include <google/protobuf/stubs/platform_macros.h> + #undef PROTOBUF_LITTLE_ENDIAN #ifdef _WIN32 // Assuming windows is always little-endian. @@ -359,7 +361,12 @@ class Bits { } static uint32 Log2FloorNonZero64(uint64 n) { -#if defined(__GNUC__) + // arm-nacl-clang runs into an instruction-selection failure when it + // encounters __builtin_clzll: + // https://bugs.chromium.org/p/nativeclient/issues/detail?id=4395 + // To work around this, when we build for NaCl we use the portable + // implementation instead. +#if defined(__GNUC__) && !defined(GOOGLE_PROTOBUF_OS_NACL) return 63 ^ __builtin_clzll(n); #else return Log2FloorNonZero64_Portable(n); |