-
Notifications
You must be signed in to change notification settings - Fork 2.1k
sys/atomic_utils: add helpers for unsigned int #21429
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
Conversation
6ca4434
to
3efb0be
Compare
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please squash.
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 <crasbe@gmail.com>
cbf6593
to
e258a07
Compare
Thx a lot for the review :) |
Contribution description
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.
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_u16
depending 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
unsgined
for the flags, rather thanuint16_t
oruint32_t
depending on the word size of the target board.