aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/wire_format_lite.h
diff options
context:
space:
mode:
authorGravatar Jisi Liu <jisi.liu@gmail.com>2017-07-18 16:26:16 -0700
committerGravatar Jisi Liu <jisi.liu@gmail.com>2017-07-18 16:26:16 -0700
commit3af881c7e2db0553207876acbdb91c6e77974e44 (patch)
tree35e2a96cce802d4235bd29afa396e28ead892fa2 /src/google/protobuf/wire_format_lite.h
parent86975301f1876ce1934612777b8ca6c76520f5cc (diff)
parent942a29cecd36f2a4b22fdd2179635cd548e6bd27 (diff)
Merge master into 3.4.x
Diffstat (limited to 'src/google/protobuf/wire_format_lite.h')
-rw-r--r--src/google/protobuf/wire_format_lite.h12
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