Skip to content
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

Define align_up() helper via macro #949

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

d-e-s-o
Copy link
Collaborator

@d-e-s-o d-e-s-o commented Dec 30, 2024

We may need additional variants of the align_up() helper function for different integer types in the future. While it is possible to abstract over all the nitty gritty details of generic integer operations, it requires complex trait machinery in the form of the num-traits crate. For us it makes more sense to just duplicate the logic via macros. Prepare for that by defining align_up() in terms of a macro.

Signed-off-by: Daniel Müller <[email protected]

We may need additional variants of the align_up() helper function for
different integer types in the future. While it is possible to abstract
over all the nitty gritty details of generic integer operations, it
requires complex trait machinery in the form of the num-traits crate.
For us it makes more sense to just duplicate the logic via macros.
Prepare for that by defining align_up() in terms of a macro.

Signed-off-by: Daniel Müller <[email protected]>
Copy link

codecov bot commented Dec 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.60%. Comparing base (7008006) to head (599d2c0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #949   +/-   ##
=======================================
  Coverage   94.60%   94.60%           
=======================================
  Files          57       57           
  Lines       10650    10650           
=======================================
  Hits        10075    10075           
  Misses        575      575           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@d-e-s-o d-e-s-o force-pushed the topic/align_up-macro branch from 599d2c0 to 5c43a71 Compare December 30, 2024 18:45
@d-e-s-o d-e-s-o merged commit c3610d2 into libbpf:main Dec 30, 2024
1 of 6 checks passed
@d-e-s-o d-e-s-o deleted the topic/align_up-macro branch December 30, 2024 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant