-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch TLV::Tag to being a struct #13219
Merged
bzbarsky-apple
merged 2 commits into
project-chip:master
from
bzbarsky-apple:tlv-tag-class
Dec 23, 2021
Merged
Switch TLV::Tag to being a struct #13219
bzbarsky-apple
merged 2 commits into
project-chip:master
from
bzbarsky-apple:tlv-tag-class
Dec 23, 2021
Conversation
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
The changes to the static TLV tags in groups code are to reduce codesize: constexpr functions get compiled smaller than static constexpr variables.
This leads to smaller compiled code. We might be able to get the same with an inline constexpr variable, but those are C++17. This diff waas mostly generated with: git grep -l AnonymousTag | xargs perl -pi -e 's/AnonymousTag/AnonymousTag()/g'
pullapprove
bot
requested review from
andy31415,
anush-apple,
austinh0,
balducci-apple,
Byungjoo-Lee,
carol-apple,
chrisdecenzo,
chshu,
chulspro,
Damian-Nordic,
dhrishi,
electrocucaracha,
erjiaqing,
franck-apple,
gjc13,
hawk248,
holbrookt,
jelderton,
jepenven-silabs,
jmartinez-silabs,
kghost,
LuDuda,
msandstedt,
mspang,
pan-apple and
robszewczyk
December 22, 2021 17:01
pullapprove
bot
requested review from
sagar-apple,
saurabhst,
selissia,
tecimovic,
turon,
vijs,
vivien-apple,
wbschiller,
woody-apple,
xylophone21 and
yunhanw-google
December 22, 2021 17:01
PR #13219: Size comparison from fcbcac2 to ea56438 Increases above 0.2%:
Increases (14 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
Decreases (9 builds for esp32, k32w, mbed, nrfconnect, qpg)
Full report (31 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
emargolis
approved these changes
Dec 22, 2021
saurabhst
approved these changes
Dec 23, 2021
msandstedt
approved these changes
Dec 23, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
People keep mixing up tags and tag numbers.
Change overview
Make Tag a struct with constexpr constructor.
There are some changes to replace const static members with constexpr functions (which are smaller codesize-wise than static constexpr members), and to replace AnonymousTag with a constexpr function, also because this reduces codesize compared to it being a static constexpr variable.
Without those various changes the codesize increase was close to 1KB instead of ~200 bytes.
I've left the methods that operate on Tag instances as free functions for now, but as a followup we can make them be class members.
Testing
Tree compiles. No behavior changes intended.