sys/atomic_utils: add helpers for unsigned int#21429
Merged
crasbe merged 1 commit intoRIOT-OS:masterfrom Apr 24, 2025
Merged
Conversation
6ca4434 to
3efb0be
Compare
crasbe
reviewed
Apr 23, 2025
Contributor
|
From a documentation standpoint I think it would be good to add a remark that the new functions automagically choose the right size. Otherwise just looking at the documentation, I wouldn't really know how/why to use the new functions over the existing ones. |
crasbe
reviewed
Apr 24, 2025
So far, the atomic utils only support known width integer types. This adds `unsigned int` to the supported list by mapping it to the corresponding fixed width integer type. This also sneaks in a few minor style fixes that clang-tidy frowned upon. Co-authored-by: crasbe <[email protected]>
cbf6593 to
e258a07
Compare
Member
Author
|
Thx a lot for the review :) |
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.
Contribution description
So far, the atomic utils only support known width integer types. This adds
unsigned intto the supported list by mapping it to the corresponding fixed width integer type.This also sneaks in a few minor style fixes that clang-tidy frowned upon.
Testing procedure
This does not really add new functionality, but exposes the existing functionality under an alias that e.g. maps
atomic_store_unsigned()to eitheratomic_store_u64(),atomic_store_u32(), oratomic_store_u16depending on the native width ofunsigned int.The code change is trivial, and easy to follow.
Issues/PRs references
Could by used by #21254 to simplify the code a bit and reducing the preprocessor use by just using
unsginedfor the flags, rather thanuint16_toruint32_tdepending on the word size of the target board.