Skip to content

Commit

Permalink
Simplify verify_args function to fix error C3249
Browse files Browse the repository at this point in the history
  • Loading branch information
mutouyun committed Jan 11, 2025
1 parent 6509836 commit 49d22b3
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/libipc/mem/verify_args.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 49d22b3

Please sign in to comment.