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/type.pb.cc | |
parent | 0026dff9f6e7fbea541fd293cbf8ebcd254e374d (diff) | |
download | protobuf-9db5b11c9cf2922435b53495b9c1e114525f0428.tar.gz protobuf-9db5b11c9cf2922435b53495b9c1e114525f0428.tar.bz2 protobuf-9db5b11c9cf2922435b53495b9c1e114525f0428.zip |
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/type.pb.cc')
-rw-r--r-- | src/google/protobuf/type.pb.cc | 78 |
1 files changed, 52 insertions, 26 deletions
diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index 36d5ba40..1eb23ff5 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -486,7 +486,8 @@ bool Type::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // string name = 1; case 1: { - if (tag == 10u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -501,7 +502,8 @@ bool Type::MergePartialFromCodedStream( // repeated .google.protobuf.Field fields = 2; case 2: { - if (tag == 18u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(18u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_fields())); @@ -514,7 +516,8 @@ bool Type::MergePartialFromCodedStream( // repeated string oneofs = 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->add_oneofs())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -530,7 +533,8 @@ bool Type::MergePartialFromCodedStream( // repeated .google.protobuf.Option options = 4; case 4: { - if (tag == 34u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(34u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_options())); @@ -543,7 +547,8 @@ bool Type::MergePartialFromCodedStream( // .google.protobuf.SourceContext source_context = 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_source_context())); } else { @@ -554,7 +559,8 @@ bool Type::MergePartialFromCodedStream( // .google.protobuf.Syntax syntax = 6; case 6: { - if (tag == 48u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(48u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -1243,7 +1249,8 @@ bool Field::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // .google.protobuf.Field.Kind kind = 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>( @@ -1257,7 +1264,8 @@ bool Field::MergePartialFromCodedStream( // .google.protobuf.Field.Cardinality cardinality = 2; case 2: { - if (tag == 16u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(16u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -1271,7 +1279,8 @@ bool Field::MergePartialFromCodedStream( // int32 number = 3; case 3: { - if (tag == 24u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(24u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -1284,7 +1293,8 @@ bool Field::MergePartialFromCodedStream( // string name = 4; case 4: { - if (tag == 34u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(34u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -1299,7 +1309,8 @@ bool Field::MergePartialFromCodedStream( // string type_url = 6; case 6: { - if (tag == 50u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(50u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_type_url())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -1314,7 +1325,8 @@ bool Field::MergePartialFromCodedStream( // int32 oneof_index = 7; case 7: { - if (tag == 56u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(56u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -1327,7 +1339,8 @@ bool Field::MergePartialFromCodedStream( // bool packed = 8; case 8: { - if (tag == 64u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(64u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -1340,7 +1353,8 @@ bool Field::MergePartialFromCodedStream( // repeated .google.protobuf.Option options = 9; case 9: { - if (tag == 74u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(74u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_options())); @@ -1353,7 +1367,8 @@ bool Field::MergePartialFromCodedStream( // string json_name = 10; case 10: { - if (tag == 82u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(82u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_json_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -1368,7 +1383,8 @@ bool Field::MergePartialFromCodedStream( // string default_value = 11; case 11: { - if (tag == 90u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(90u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_default_value())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -2279,7 +2295,8 @@ bool Enum::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // string name = 1; case 1: { - if (tag == 10u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -2294,7 +2311,8 @@ bool Enum::MergePartialFromCodedStream( // repeated .google.protobuf.EnumValue enumvalue = 2; case 2: { - if (tag == 18u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(18u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_enumvalue())); @@ -2307,7 +2325,8 @@ bool Enum::MergePartialFromCodedStream( // repeated .google.protobuf.Option options = 3; case 3: { - if (tag == 26u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(26u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_options())); @@ -2320,7 +2339,8 @@ bool Enum::MergePartialFromCodedStream( // .google.protobuf.SourceContext source_context = 4; case 4: { - if (tag == 34u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(34u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_source_context())); } else { @@ -2331,7 +2351,8 @@ bool Enum::MergePartialFromCodedStream( // .google.protobuf.Syntax syntax = 5; case 5: { - if (tag == 40u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(40u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -2888,7 +2909,8 @@ bool EnumValue::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // string name = 1; case 1: { - if (tag == 10u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -2903,7 +2925,8 @@ bool EnumValue::MergePartialFromCodedStream( // int32 number = 2; case 2: { - if (tag == 16u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(16u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -2916,7 +2939,8 @@ bool EnumValue::MergePartialFromCodedStream( // repeated .google.protobuf.Option options = 3; case 3: { - if (tag == 26u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(26u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_options())); @@ -3379,7 +3403,8 @@ bool Option::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // string name = 1; case 1: { - if (tag == 10u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -3394,7 +3419,8 @@ bool Option::MergePartialFromCodedStream( // .google.protobuf.Any value = 2; case 2: { - if (tag == 18u) { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>(18u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_value())); } else { |