aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJoost Peters2009-08-02 17:58:48 +0000
committerJoost Peters2009-08-02 17:58:48 +0000
commit7d3f68154f4d7194c245461a11e9d81febdc6c42 (patch)
treeb7ed75f69ddbd42c9d6aeb86f322540841b84b3f /engines
parent5591bf368ca8a431a7a03272e0ec7330befbe8d8 (diff)
downloadscummvm-rg350-7d3f68154f4d7194c245461a11e9d81febdc6c42.tar.gz
scummvm-rg350-7d3f68154f4d7194c245461a11e9d81febdc6c42.tar.bz2
scummvm-rg350-7d3f68154f4d7194c245461a11e9d81febdc6c42.zip
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
Diffstat (limited to 'engines')
-rw-r--r--engines/tinsel/heapmem.cpp3
1 files changed, 2 insertions, 1 deletions
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) {