-
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
ecies: use align_num value #12139
base: main
Are you sure you want to change the base?
ecies: use align_num value #12139
Conversation
crates/net/ecies/src/algorithm.rs
Outdated
/// return num alignment value | ||
#[inline] | ||
const fn align_num(num: usize, align: usize) -> usize { | ||
(num + (align - 1)) & !(align - 1) | ||
} |
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.
@DaniPopes need help here 🙃, is this euqivalent
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.
https://stackoverflow.com/questions/45213511/formula-for-memory-alignment
https://stackoverflow.com/questions/14561402/how-is-this-size-alignment-working , some c code like linux kernel, and hack's delight introduced this
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.
this should be equal to ".next_multiple_of"
No description provided.