Skip to content

Commit

Permalink
Clang-tidy fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjp41 committed Jul 31, 2023
1 parent 1283362 commit ce14302
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/snmalloc/override/libc.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ namespace snmalloc::libc

inline void* memalign(size_t alignment, size_t size)
{
if ((alignment == 0) || (alignment == size_t(-1)))
if (alignment < sizeof(uintptr_t) || bits::is_pow2(alignment))
{
return set_error(EINVAL);
}
Expand All @@ -164,7 +164,7 @@ namespace snmalloc::libc

inline int posix_memalign(void** memptr, size_t alignment, size_t size)
{
if ((alignment < sizeof(uintptr_t) || ((alignment & (alignment - 1)) != 0)))
if ((alignment < sizeof(uintptr_t) || bits::is_pow2(alignment)))
{
return EINVAL;
}
Expand All @@ -178,4 +178,4 @@ namespace snmalloc::libc
*memptr = p;
return 0;
}
}
} // namespace snmalloc::libc

0 comments on commit ce14302

Please sign in to comment.