Browse Source

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

Nicola Orlando 7 years ago
parent
commit
a9961b7c70
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/common/memory.cpp

+ 1 - 1
src/common/memory.cpp

@@ -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
 }