Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Conversation

@swernli
Copy link
Collaborator

@swernli swernli commented Feb 2, 2022

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.

@swernli swernli requested review from idavis and kuzminrobin February 2, 2022 20:19
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(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);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@swernli
Copy link
Collaborator Author

swernli commented Feb 3, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@swernli
Copy link
Collaborator Author

swernli commented Feb 3, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@swernli swernli enabled auto-merge (squash) February 3, 2022 07:53
@swernli swernli merged commit 46b4247 into main Feb 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants