cacay/MemoryPool

padding function

heroazhe opened this issue · 0 comments

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