diff options
Diffstat (limited to 'src/google/protobuf/wire_format_lite.h')
-rw-r--r-- | src/google/protobuf/wire_format_lite.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h index 346d5b2a..3e079ea5 100644 --- a/src/google/protobuf/wire_format_lite.h +++ b/src/google/protobuf/wire_format_lite.h @@ -202,7 +202,7 @@ class LIBPROTOBUF_EXPORT WireFormatLite { // type-safe, though, so prefer it if possible. #define GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(FIELD_NUMBER, TYPE) \ static_cast<uint32>( \ - ((FIELD_NUMBER) << ::google::protobuf::internal::WireFormatLite::kTagTypeBits) \ + (static_cast<uint32>(FIELD_NUMBER) << ::google::protobuf::internal::WireFormatLite::kTagTypeBits) \ | (TYPE)) // These are the tags for the old MessageSet format, which was defined as: @@ -792,7 +792,7 @@ inline int WireFormatLite::GetTagFieldNumber(uint32 tag) { inline size_t WireFormatLite::TagSize(int field_number, WireFormatLite::FieldType type) { size_t result = io::CodedOutputStream::VarintSize32( - field_number << kTagTypeBits); + static_cast<uint32>(field_number << kTagTypeBits)); if (type == TYPE_GROUP) { // Groups have both a start and an end tag. return result * 2; @@ -851,20 +851,20 @@ inline double WireFormatLite::DecodeDouble(uint64 value) { inline uint32 WireFormatLite::ZigZagEncode32(int32 n) { // Note: the right-shift must be arithmetic - return (static_cast<uint32>(n) << 1) ^ (n >> 31); + return static_cast<uint32>((n << 1) ^ (n >> 31)); } inline int32 WireFormatLite::ZigZagDecode32(uint32 n) { - return (n >> 1) ^ -static_cast<int32>(n & 1); + return static_cast<int32>(n >> 1) ^ -static_cast<int32>(n & 1); } inline uint64 WireFormatLite::ZigZagEncode64(int64 n) { // Note: the right-shift must be arithmetic - return (static_cast<uint64>(n) << 1) ^ (n >> 63); + return static_cast<uint64>((n << 1) ^ (n >> 63)); } inline int64 WireFormatLite::ZigZagDecode64(uint64 n) { - return (n >> 1) ^ -static_cast<int64>(n & 1); + return static_cast<int64>(n >> 1) ^ -static_cast<int64>(n & 1); } // String is for UTF-8 text only, but, even so, ReadString() can simply |