From 7d3f68154f4d7194c245461a11e9d81febdc6c42 Mon Sep 17 00:00:00 2001 From: Joost Peters Date: Sun, 2 Aug 2009 17:58:48 +0000 Subject: 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 svn-id: r43005 --- engines/tinsel/heapmem.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/tinsel') diff --git a/engines/tinsel/heapmem.cpp b/engines/tinsel/heapmem.cpp index e77f505edb..9b4447509e 100644 --- a/engines/tinsel/heapmem.cpp +++ b/engines/tinsel/heapmem.cpp @@ -285,7 +285,8 @@ MEM_NODE *MemoryAlloc(int flags, long size) { } #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) { -- cgit v1.2.3