Repository navigation
Conversation
zherczeg
reviewed
Jun 23, 2026
| template <typename T, size_t (*ReadFn)(const uint8_t*, const uint8_t*, T*)> | ||
| Result BinaryReader::ReadLeb128(T* out_value, | ||
| const char* desc, | ||
| const char* type_name) { |
Collaborator
There was a problem hiding this comment.
Could we encode this as template arg?
Member
Author
There was a problem hiding this comment.
I think that would mean defining separate static consts like:
constexpr char kU32Name[] = "u32";
constexpr char kU64Name[] = "u64";
constexpr char kI32Name[] = "i32";
constexpr char kI64Name[] = "i64";
Which I think makes the code a little less readable. Is there some big advantage to doing that?
Collaborator
There was a problem hiding this comment.
What about two args: bool signed (or char signed) and int bits?
The advantage of templates is pre-computing consts.
If you prefer we can leave the code this way.
Member
Author
There was a problem hiding this comment.
How about we land this change and you can propose a following you like?
Collaborator
|
I like this idea! |
sbc100
enabled auto-merge (squash)
June 23, 2026 16:55
sbc100
disabled auto-merge
June 23, 2026 16:55
This file contains hidden or 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
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.
No description provided.