diff options
-rw-r--r-- | src/google/protobuf/map.h | 4 | ||||
-rw-r--r-- | src/google/protobuf/stubs/port.h | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index 61a23897..e6d78b20 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -1290,7 +1290,9 @@ class Map { // Return a power of two no less than max(kMinTableSize, n). // Assumes either n < kMinTableSize or n is a power of two. size_type TableSize(size_type n) { - return n < kMinTableSize ? kMinTableSize : n; + return n < static_cast<size_type>(kMinTableSize) + ? static_cast<size_type>(kMinTableSize) + : n; } // Use alloc_ to allocate an array of n objects of type U. 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); |