[Scummvm-cvs-logs] SF.net SVN: scummvm:[43005] scummvm/trunk/engines/tinsel/heapmem.cpp

joostp at users.sourceforge.net joostp at users.sourceforge.net
Sun Aug 2 19:58:48 CEST 2009


Revision: 43005
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43005&view=rev
Author:   joostp
Date:     2009-08-02 17:58:48 +0000 (Sun, 02 Aug 2009)

Log Message:
-----------
align memory handles to sizeof(void*) instead of 4 (which is just good enough for 32-bit) - this fixes DW2 on 64-bit systems that require alignment

Modified Paths:
--------------
    scummvm/trunk/engines/tinsel/heapmem.cpp

Modified: scummvm/trunk/engines/tinsel/heapmem.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/heapmem.cpp	2009-08-02 17:35:34 UTC (rev 43004)
+++ scummvm/trunk/engines/tinsel/heapmem.cpp	2009-08-02 17:58:48 UTC (rev 43005)
@@ -285,7 +285,8 @@
 	}
 
 #ifdef SCUMM_NEED_ALIGNMENT
-	size = (size + 3) & ~3;	//round up to nearest multiple of 4, this ensures the addresses that are returned are 4-byte aligned as well.
+	const int alignPadding = sizeof(void*) - 1;
+	size = (size + alignPadding) & ~alignPadding;	//round up to nearest multiple of sizeof(void*), this ensures the addresses that are returned are alignment-safe.
 #endif
 
 	while ((flags & DWM_NOALLOC) == 0 && bCompacted) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list