aboutsummaryrefslogtreecommitdiffstats
path: root/code/qcommon
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-12-05 17:32:54 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-12-05 17:32:54 +0000
commit1fa5872b59f24cb05e82c4124ddb455834dd9f37 (patch)
treeeb835a752c2915f487b9d1d33e5e4e322b4dd45a /code/qcommon
parent5da02a4301441953f1b20d10e7cbbc3e8498d959 (diff)
downloadioquake3-aero-1fa5872b59f24cb05e82c4124ddb455834dd9f37.tar.gz
ioquake3-aero-1fa5872b59f24cb05e82c4124ddb455834dd9f37.zip
* Replaced ALIGN macro with PAD
* Moved ALIGN16 macro from tr_local.h to ALIGN in q_shared.h git-svn-id: svn://svn.icculus.org/quake3/trunk@417 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/qcommon')
-rw-r--r--code/qcommon/common.c4
-rw-r--r--code/qcommon/q_shared.h8
2 files changed, 9 insertions, 3 deletions
diff --git a/code/qcommon/common.c b/code/qcommon/common.c
index 3839f7b..b9de067 100644
--- a/code/qcommon/common.c
+++ b/code/qcommon/common.c
@@ -929,7 +929,7 @@ void *Z_TagMalloc( int size, int tag ) {
//
size += sizeof(memblock_t); // account for size of block header
size += 4; // space for memory trash tester
- size = ALIGN(size); // align to 32/64 bit boundary
+ size = PAD(size, sizeof(long)); // align to 32/64 bit boundary
base = rover = zone->rover;
start = base->prev;
@@ -1746,7 +1746,7 @@ void *Hunk_AllocateTempMemory( int size ) {
Hunk_SwapBanks();
- size = ALIGN(size) + sizeof( hunkHeader_t );
+ size = PAD(size, sizeof(long)) + sizeof( hunkHeader_t );
if ( hunk_temp->temp + hunk_permanent->permanent + size > s_hunkTotal ) {
Com_Error( ERR_DROP, "Hunk_AllocateTempMemory: failed on %i", size );
diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h
index 45bd046..d6c69dc 100644
--- a/code/qcommon/q_shared.h
+++ b/code/qcommon/q_shared.h
@@ -111,7 +111,13 @@ typedef int sfxHandle_t;
typedef int fileHandle_t;
typedef int clipHandle_t;
-#define ALIGN(x) ((x+sizeof(long)-1) & ~(sizeof(long)-1))
+#define PAD(x,y) (((x)+(y)-1) & ~((y)-1))
+
+#ifdef __GNUC__
+#define ALIGN(x) __attribute__((aligned(x)))
+#else
+#define ALIGN(x)
+#endif
#ifndef NULL
#define NULL ((void *)0)