зеркало из https://github.com/microsoft/snmalloc.git
aligned_alloc: Permit alignment values smaller than sizeof(uintptr_t) (#671)
posix_memalign() requires alignment values of at least
sizeof(uintptr_t), but aligned_alloc() does not. memalign() regressed
to require larger alignment in commit
6cbc50fe2c
.
Fixes #668
This commit is contained in:
Родитель
6af38acd94
Коммит
fcad15456b
|
@ -145,8 +145,7 @@ namespace snmalloc::libc
|
|||
|
||||
inline void* memalign(size_t alignment, size_t size)
|
||||
{
|
||||
if (SNMALLOC_UNLIKELY(
|
||||
alignment < sizeof(uintptr_t) || !bits::is_pow2(alignment)))
|
||||
if (SNMALLOC_UNLIKELY(alignment == 0 || !bits::is_pow2(alignment)))
|
||||
{
|
||||
return set_error(EINVAL);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче