This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Conversation
kuzminrobin
reviewed
Feb 2, 2022
| assert(this->count * (TBufSize)itemSizeInBytes < std::numeric_limits<TBufSize>::max()); | ||
| // Using `<` rather than `<=` to calm down the compiler on 32-bit arch. | ||
| const TBufSize bufferSize = this->count * itemSizeInBytes; | ||
| const TBufSize bufferSize = (TBufSize)this->count * (TBufSize)itemSizeInBytes; |
Contributor
There was a problem hiding this comment.
(nit) For the future: It is probably more efficient to do the operation first, and then cast the result.
Suggested change
| const TBufSize bufferSize = (TBufSize)this->count * (TBufSize)itemSizeInBytes; | |
| const TBufSize bufferSize = (TBufSize)(this->count * itemSizeInBytes); |
Collaborator
Author
There was a problem hiding this comment.
I think that would work here, yes. But I was a little concerned about a future where these two types would differ. Right now, this->count is of type TItemCount while itemSizeInBytes is of type TItemSize. It just so happens that both of these are uint32_t, but since they are independently defined they could vary. If we want to tie these values together more closely, we could consider consolidating TItemCount and TItemSize into one type.
kuzminrobin
approved these changes
Feb 2, 2022
Collaborator
Author
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Collaborator
Author
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This updates the tools used by the build scripts, CI pipeline, and linter/formatter to LLVM 13. Notably, the update to the newer version of clang-tidy required cleaning up some C++ patterns that were previously accepted under LLVM 11.