Parcourir la source

Bugfix: Resolving an issue with aligned memory allocation. Fixes #95

BearishSun il y a 8 ans
Parent
commit
78b17cdd37
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      Source/BansheeUtility/Allocators/BsMemoryAllocator.h

+ 1 - 1
Source/BansheeUtility/Allocators/BsMemoryAllocator.h

@@ -85,7 +85,7 @@ namespace bs
 			return nullptr;
 			return nullptr;
 
 
 		UINT8* alignedData = ((UINT8*)data) + sizeof(void*);
 		UINT8* alignedData = ((UINT8*)data) + sizeof(void*);
-		alignedData += alignment - ((uintptr_t)alignedData) & (alignment - 1);
+		alignedData += (alignment - ((uintptr_t)alignedData) & (alignment - 1)) & (alignment - 1);
 
 
 		((void**)alignedData)[-1] = data;
 		((void**)alignedData)[-1] = data;
 		return alignedData;
 		return alignedData;