-
Notifications
You must be signed in to change notification settings - Fork 2k
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
core/macros: add math helper macros #17702
Conversation
e896b1c
to
e7d36e6
Compare
... and they are supposed to be used in compile-time situations, I guess? |
Also at run-time. |
e7d36e6
to
a93aa29
Compare
a93aa29
to
7063210
Compare
Lines 63 to 71 in 6db9960
Yes, indeed. Is just one of the cases where this would have been useful. |
7063210
to
27b3c11
Compare
Contribution description
This adds a few commonly useful math helper macros to
core/macros
:SIGNOF()
returns the sign of an integerDIV_ROUND()
performs arithmetic integer divisionDIV_ROUND_UP()
performs arithmetic integer division, always rounding to the next integer larger in magnitude.Testing procedure
unittests/tests-core
was extended with test cases for the new macrosIssues/PRs references