r231 - trunk/code/qcommon

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Nov 2 15:34:25 EST 2005


Author: ludwig
Date: 2005-11-02 15:34:25 -0500 (Wed, 02 Nov 2005)
New Revision: 231

Modified:
   trunk/code/qcommon/common.c
Log:
allocate memory pointer aligned


Modified: trunk/code/qcommon/common.c
===================================================================
--- trunk/code/qcommon/common.c	2005-11-02 18:32:03 UTC (rev 230)
+++ trunk/code/qcommon/common.c	2005-11-02 20:34:25 UTC (rev 231)
@@ -927,7 +927,7 @@
 	//
 	size += sizeof(memblock_t);	// account for size of block header
 	size += 4;					// space for memory trash tester
-	size = (size + 3) & ~3;		// align to 32 bit boundary
+	size = (size + sizeof(void*)-1)&~(sizeof(void*)-1);		// align to 32/64 bit boundary
 	
 	base = rover = zone->rover;
 	start = base->prev;
@@ -1744,7 +1744,7 @@
 
 	Hunk_SwapBanks();
 
-	size = ( (size+3)&~3 ) + sizeof( hunkHeader_t );
+	size = ( (size+sizeof(void*)-1)&~(sizeof(void*)-1) ) + sizeof( hunkHeader_t );
 
 	if ( hunk_temp->temp + hunk_permanent->permanent + size > s_hunkTotal ) {
 		Com_Error( ERR_DROP, "Hunk_AllocateTempMemory: failed on %i", size );




More information about the quake3-commits mailing list