diff options
author | Chris Kennelly <ckennelly@google.com> | 2017-01-24 17:37:33 -0800 |
---|---|---|
committer | Chris Kennelly <ckennelly@google.com> | 2017-02-15 11:39:39 -0800 |
commit | 9db5b11c9cf2922435b53495b9c1e114525f0428 (patch) | |
tree | be2e4da2021e6d25558ec2595f615724d9839781 /src/google/protobuf/struct.pb.cc | |
parent | 0026dff9f6e7fbea541fd293cbf8ebcd254e374d (diff) |
Work with truncated tag numbers.
This allows more compact comparisons (1 byte instead of 4 byte
immediates on x86) for each possible wire/tag inside each field.
Diffstat (limited to 'src/google/protobuf/struct.pb.cc')
-rw-r--r-- | src/google/protobuf/struct.pb.cc | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index 332a8295..1350085c 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -306,7 +306,8 @@ bool Struct::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // map<string, .google.protobuf.Value> fields = 1; case 1: { - if (tag == 10u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(10u)) { DO_(input->IncrementRecursionDepth()); Struct_FieldsEntry::Parser< ::google::protobuf::internal::MapField< ::std::string, ::google::protobuf::Value, @@ -769,7 +770,8 @@ bool Value::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // .google.protobuf.NullValue null_value = 1; case 1: { - if (tag == 8u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(8u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -783,7 +785,8 @@ bool Value::MergePartialFromCodedStream( // double number_value = 2; case 2: { - if (tag == 17u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(17u)) { clear_kind(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( @@ -797,7 +800,8 @@ bool Value::MergePartialFromCodedStream( // string string_value = 3; case 3: { - if (tag == 26u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(26u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_string_value())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -812,7 +816,8 @@ bool Value::MergePartialFromCodedStream( // bool bool_value = 4; case 4: { - if (tag == 32u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(32u)) { clear_kind(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -826,7 +831,8 @@ bool Value::MergePartialFromCodedStream( // .google.protobuf.Struct struct_value = 5; case 5: { - if (tag == 42u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(42u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_struct_value())); } else { @@ -837,7 +843,8 @@ bool Value::MergePartialFromCodedStream( // .google.protobuf.ListValue list_value = 6; case 6: { - if (tag == 50u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(50u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_list_value())); } else { @@ -1590,7 +1597,8 @@ bool ListValue::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated .google.protobuf.Value values = 1; case 1: { - if (tag == 10u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(10u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_values())); |