Reversed alignedMalloc return value.

posix_memalign returns false on success; using == 0 instead of != 0 reverses it, allowing alignedMalloc to return true on success and false otherwise (mimicking what happens under Windows).

--HG--
branch : Nixola/reversed-alignedmalloc-return-value-posi-1512135128149
This commit is contained in:
Nicola Orlando
2017-12-01 13:32:51 +00:00
parent fccc6fa733
commit a9961b7c70
+1 -1
View File
@@ -38,7 +38,7 @@ bool alignedMalloc(void **mem, size_t size, size_t alignment)
*mem = _aligned_malloc(size, alignment);
return *mem != nullptr;
#else
return posix_memalign(mem, alignment, size) != 0;
return posix_memalign(mem, alignment, size) == 0;
#endif
}