mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
Simplify verify_args function to fix error C3249
This commit is contained in:
parent
86d9d868c8
commit
99272a452a
@ -9,13 +9,7 @@ namespace mem {
|
||||
* \brief Check that bytes is not 0 and that the alignment is a power of two.
|
||||
*/
|
||||
inline constexpr bool verify_args(std::size_t bytes, std::size_t alignment) noexcept {
|
||||
if (bytes == 0) {
|
||||
return false;
|
||||
}
|
||||
if ((alignment == 0) || (alignment & (alignment - 1)) != 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return (bytes > 0) && (alignment > 0) && ((alignment & (alignment - 1)) == 0);
|
||||
}
|
||||
|
||||
} // namespace mem
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user