mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-07 01:06:45 +08:00
add make_align for size alignment
This commit is contained in:
parent
a4a7b85f47
commit
d6ab58fc6f
@ -53,4 +53,9 @@ T horrible_cast(U val) {
|
||||
return u.out;
|
||||
}
|
||||
|
||||
IPC_CONSTEXPR_ std::size_t make_align(std::size_t align, std::size_t size) {
|
||||
// align must be 2^n
|
||||
return (size + align - 1) & ~(align - 1);
|
||||
}
|
||||
|
||||
} // namespace ipc
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user