shithub: choc

Download patch

ref: d6a516833146d29d5e7b0d4f8ed6b80ecb193b88
parent: aa5b8eba10fb1122c64c42122bfd48d7a7c7d745
author: Simon Howard <[email protected]>
date: Fri Aug 20 08:20:58 EDT 2010

Align memory allocated by zone memory system to 8 byte boundaries on
64-bit machines. Possibly fixes problems on sparc64?

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1959

--- a/src/z_zone.c
+++ b/src/z_zone.c
@@ -41,6 +41,7 @@
 //  because it will get overwritten automatically if needed.
 // 
  
+#define MEM_ALIGN sizeof(void *)
 #define ZONEID	0x1d4a11
 
 typedef struct memblock_s
@@ -201,7 +202,7 @@
     memblock_t*	base;
     void *result;
 
-    size = (size + 3) & ~3;
+    size = (size + MEM_ALIGN - 1) & ~(MEM_ALIGN - 1);
     
     // scan through the block list,
     // looking for the first free block