Fix compilation issue with Visual Studio

This commit is contained in:
Daniel Chappuis 2022-03-28 21:48:18 +02:00
parent 0d18610298
commit 8b18ee22f3
2 changed files with 5 additions and 4 deletions

View File

@ -7,7 +7,8 @@
### Changed
- The library must now be compiled with C++ 17 compiler
- If the user sets its custom allocator, the return allocated memory must now be 16 bytes aligned
- If the user sets its own custom allocator, the return allocated memory must now be 16 bytes aligned
- The internal allocators now allocates memory that is 16-bytes aligned
### Removed

View File

@ -59,8 +59,8 @@ class DefaultAllocator : public MemoryAllocator {
// If compiler is Visual Studio
#ifdef RP3D_COMPILER_VISUAL_STUDIO
// Visual Studio doesn't not support standard std:aligned_alloc() method from c++ 17
return _alligned_malloc(size, GLOBAL_ALIGNMENT);
// Visual Studio doesn't not support standard std:aligned_alloc() method from C++ 17
return _aligned_malloc(size, GLOBAL_ALIGNMENT);
#else
// Return 16-bytes aligned memory
@ -75,7 +75,7 @@ class DefaultAllocator : public MemoryAllocator {
#ifdef RP3D_COMPILER_VISUAL_STUDIO
// Visual Studio doesn't not support standard std:aligned_alloc() method from c++ 17
return _aligned_free(GLOBAL_ALIGNMENT, pointer);
return _aligned_free(pointer);
#else
return std::free(pointer);