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

padding function #10

Open
heroazhe opened this issue Apr 16, 2021 · 0 comments
Open

padding function #10

heroazhe opened this issue Apr 16, 2021 · 0 comments

Comments

@heroazhe
Copy link

when i use the padding function from this code,i found that the summary of address and padding mod align bytes cant be zero sometimes.Should it be a problem? I google the padding problem,someone say the padding function should be like this: inline size_t padding(int* p, size_t align) noexcept
{
uintptr_t result = reinterpret_cast<uintptr_t>(p);
return ((align - (result%align)) % align);
}`
I make a few tests,it works

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

No branches or pull requests

1 participant