[Scummvm-cvs-logs] SF.net SVN: scummvm:[43006] scummvm/branches/branch-1-0-0/engines/tinsel/ heapmem.cpp

joostp at users.sourceforge.net joostp at users.sourceforge.net
Sun Aug 2 19:59:45 CEST 2009


Revision: 43006
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43006&view=rev
Author:   joostp
Date:     2009-08-02 17:59:45 +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/branches/branch-1-0-0/engines/tinsel/heapmem.cpp

Modified: scummvm/branches/branch-1-0-0/engines/tinsel/heapmem.cpp
===================================================================
--- scummvm/branches/branch-1-0-0/engines/tinsel/heapmem.cpp	2009-08-02 17:58:48 UTC (rev 43005)
+++ scummvm/branches/branch-1-0-0/engines/tinsel/heapmem.cpp	2009-08-02 17:59:45 UTC (rev 43006)
@@ -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