-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduced nesting in GenerateByteSize: slight readability improvements …
…in generated code. GenerateByteSize itself remains deeply nested, but by factoring out one part of the loop, at least we make the part that generates UpdateByteSize a bit more readable. Making the callsite of MayEmitIfNonDefaultCheck less nested actually resulted in slight readability improvements also in the generated code, namely of the form: @@ -10563,8 +10559,7 @@ PROTOBUF_NOINLINE void OneStringEdition: { // string data = 1; - cached_has_bits = - this_._impl_._has_bits_[0]; + cached_has_bits = this_._impl_._has_bits_[0]; if (cached_has_bits & 0x00000001u) { total_size += 1 + ::proto2::internal::WireFormatLite::StringSize( this_._internal_data()); These readability improvements should be kept IMO -- they make the generated protobuf C++ code slightly easier to read. PiperOrigin-RevId: 655180880
- Loading branch information
1 parent
a0387c1
commit 162a740
Showing
5 changed files
with
59 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.