-
Notifications
You must be signed in to change notification settings - Fork 1.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
macro/align: Use ALIGN_UP and ALIGN_DOWN uniformly #15455
base: master
Are you sure you want to change the base?
Conversation
please fix ci error:
|
uintptr_t highpc = ROUNDUP((uintptr_t)&_etext, | ||
HISTFRACTION * sizeof(HISTCOUNTER)); | ||
uintptr_t highpc = ALIGN_UP((uintptr_t)&_etext, | ||
HISTFRACTION * sizeof(HISTCOUNTER)); |
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.
it isn't obvious HISTFRACTION * sizeof(HISTCOUNTER)
is a power of two.
is it possible to have a power-of-two assertion in ALIGN_UP itself?
this PR as it is seems a bit fragile to me.
does ALIGN_UP actually produce a better code than ROUNDUP with a power of two y
with modern compilers? otherwise, maybe it's safer to drop the power-of-two assumption from ALIGN_UP.
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.
I think what you said makes sense. Let me open a new PR to fix this problem.
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.
Fix it in the patch https://github.com/apache/nuttx/pull/15493/files. Sorry, I didn't notice this problem before.
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
Note: Please adhere to Contributing Guidelines.
Summary
macro/align: Use ALIGN_UP and ALIGN_DOWN uniformly
Impact
Update this section, where applicable, on how change affects users,
build process, hardware, documentation, security, compatibility, etc.
Testing
Update this section with details on how did you verify the change,
what Host was used for build (OS, CPU, compiler, ..), what Target was
used for verification (arch, board:config, ..), etc. Providing build
and runtime logs from before and after change is highly appreciated.