Skip to content

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

Merged
merged 1 commit into from
Apr 24, 2025

Conversation

maribu
Copy link
Member

@maribu maribu commented Apr 23, 2025

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 either atomic_store_u64(), atomic_store_u32(), or atomic_store_u16 depending on the native width of unsigned 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 than uint16_t or uint32_t depending on the word size of the target board.

@maribu maribu added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: sys Area: System labels Apr 23, 2025
@riot-ci
Copy link

riot-ci commented Apr 23, 2025

Murdock results

✔️ PASSED

e258a07 sys/atomic_utils: add helpers for unsigned int

Success Failures Total Runtime
10299 0 10299 11m:26s

Artifacts

@crasbe
Copy link
Contributor

crasbe commented Apr 23, 2025

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.

Copy link
Contributor

@crasbe crasbe left a 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>
@maribu maribu force-pushed the sys/atomic_utils/unsigned branch from cbf6593 to e258a07 Compare April 24, 2025 10:23
@crasbe crasbe added this pull request to the merge queue Apr 24, 2025
Merged via the queue into RIOT-OS:master with commit d3b2660 Apr 24, 2025
25 checks passed
@maribu maribu deleted the sys/atomic_utils/unsigned branch April 24, 2025 20:18
@maribu
Copy link
Member Author

maribu commented Apr 24, 2025

Thx a lot for the review :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants