diff options
| author | Martin Ridgers <[email protected]> | 2022-01-05 12:10:03 +0100 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2022-01-05 15:15:47 +0100 |
| commit | 0798fee1c8af3c3900cda78e23601f2dde78532c (patch) | |
| tree | f86b43a973166561f013e45704a680541ccf8b6a /zencore/memory.cpp | |
| parent | Merge branch 'main' of https://github.com/EpicGames/zen (diff) | |
| download | zen-0798fee1c8af3c3900cda78e23601f2dde78532c.tar.xz zen-0798fee1c8af3c3900cda78e23601f2dde78532c.zip | |
aligned_alloc() states that size must be a multiple of alignment
Diffstat (limited to 'zencore/memory.cpp')
| -rw-r--r-- | zencore/memory.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/zencore/memory.cpp b/zencore/memory.cpp index 7f194fa8c..c50d63a1d 100644 --- a/zencore/memory.cpp +++ b/zencore/memory.cpp @@ -29,6 +29,9 @@ AlignedAllocImpl(size_t size, size_t alignment) # endif #else // posix_memalign(&Ret, Alignment, Size); // Apple, AndroidApi<28 + // aligned_alloc() states that size must be a multiple of alignment. Some + // platforms return null if this requirement isn't met. + size = (size + alignment - 1) & ~(alignment - 1); return std::aligned_alloc(alignment, size); #endif } |