aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/stubs/port.h
diff options
context:
space:
mode:
authorGravatar Bo Yang <teboring@google.com>2017-06-23 12:56:44 -0700
committerGravatar Bo Yang <paulyang1211@gmail.com>2017-06-24 11:28:13 -0700
commite3c807d4e752b477b707f5d021264faf9b127304 (patch)
tree505092dff769b14d6a07be62314bc948b9398090 /src/google/protobuf/stubs/port.h
parent9c0b35cf620c4904a18e25733f50c9c0474fefa6 (diff)
Fix more implicit type conversions in public headers and generated code.
Diffstat (limited to 'src/google/protobuf/stubs/port.h')
-rw-r--r--src/google/protobuf/stubs/port.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h
index 0afd55d7..7879aed4 100644
--- a/src/google/protobuf/stubs/port.h
+++ b/src/google/protobuf/stubs/port.h
@@ -354,7 +354,7 @@ class Bits {
public:
static uint32 Log2FloorNonZero(uint32 n) {
#if defined(__GNUC__)
- return 31 ^ __builtin_clz(n);
+ return 31 ^ static_cast<uint32>(__builtin_clz(n));
#elif defined(COMPILER_MSVC) && defined(_M_IX86)
_asm {
bsr ebx, n
@@ -373,7 +373,7 @@ class Bits {
// 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);
+ return 63 ^ static_cast<uint32>(__builtin_clzll(n));
#else
return Log2FloorNonZero64_Portable(n);
#endif
@@ -400,9 +400,9 @@ class Bits {
const uint32 topbits = static_cast<uint32>(n >> 32);
if (topbits == 0) {
// Top bits are zero, so scan in bottom bits
- return Log2FloorNonZero(static_cast<uint32>(n));
+ return static_cast<int>(Log2FloorNonZero(static_cast<uint32>(n)));
} else {
- return 32 + Log2FloorNonZero(topbits);
+ return 32 + static_cast<int>(Log2FloorNonZero(topbits));
}
}
};