r417 - in trunk/code: botlib client qcommon renderer
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Mon Dec 5 12:32:54 EST 2005
Author: tma
Date: 2005-12-05 12:32:54 -0500 (Mon, 05 Dec 2005)
New Revision: 417
Modified:
trunk/code/botlib/be_aas_route.c
trunk/code/botlib/be_ai_chat.c
trunk/code/client/snd_codec_wav.c
trunk/code/qcommon/common.c
trunk/code/qcommon/q_shared.h
trunk/code/renderer/tr_local.h
Log:
* Replaced ALIGN macro with PAD
* Moved ALIGN16 macro from tr_local.h to ALIGN in q_shared.h
Modified: trunk/code/botlib/be_aas_route.c
===================================================================
--- trunk/code/botlib/be_aas_route.c 2005-12-05 01:11:41 UTC (rev 416)
+++ trunk/code/botlib/be_aas_route.c 2005-12-05 17:32:54 UTC (rev 417)
@@ -521,7 +521,8 @@
//
size += settings->numreachableareas * sizeof(unsigned short *);
//
- size += settings->numreachableareas * ALIGN(revreach->numlinks) * sizeof(unsigned short);
+ size += settings->numreachableareas *
+ PAD(revreach->numlinks, sizeof(long)) * sizeof(unsigned short);
} //end for
//allocate memory for the area travel times
ptr = (char *) GetClearedMemory(size);
@@ -541,7 +542,7 @@
for (l = 0; l < settings->numreachableareas; l++)
{
aasworld.areatraveltimes[i][l] = (unsigned short *) ptr;
- ptr += ALIGN(revreach->numlinks) * sizeof(unsigned short);
+ ptr += PAD(revreach->numlinks, sizeof(long)) * sizeof(unsigned short);
//reachability link
reach = &aasworld.reachability[settings->firstreachablearea + l];
//
Modified: trunk/code/botlib/be_ai_chat.c
===================================================================
--- trunk/code/botlib/be_ai_chat.c 2005-12-05 01:11:41 UTC (rev 416)
+++ trunk/code/botlib/be_ai_chat.c 2005-12-05 17:32:54 UTC (rev 417)
@@ -690,7 +690,7 @@
return NULL;
} //end if
len = strlen(token.string) + 1;
- len = ALIGN(len);
+ len = PAD(len, sizeof(long));
size += sizeof(bot_synonym_t) + len;
if (pass)
{
@@ -989,7 +989,7 @@
return NULL;
} //end if
len = strlen(token.string) + 1;
- len = ALIGN(len);
+ len = PAD(len, sizeof(long));
size += sizeof(bot_randomlist_t) + len;
if (pass)
{
@@ -1020,7 +1020,7 @@
return NULL;
} //end if
len = strlen(chatmessagestring) + 1;
- len = ALIGN(len);
+ len = PAD(len, sizeof(long));
size += sizeof(bot_randomstring_t) + len;
if (pass)
{
@@ -2123,7 +2123,7 @@
return NULL;
} //end if
len = strlen(chatmessagestring) + 1;
- len = ALIGN(len);
+ len = PAD(len, sizeof(long));
if (pass)
{
chatmessage = (bot_chatmessage_t *) ptr;
Modified: trunk/code/client/snd_codec_wav.c
===================================================================
--- trunk/code/client/snd_codec_wav.c 2005-12-05 01:11:41 UTC (rev 416)
+++ trunk/code/client/snd_codec_wav.c 2005-12-05 17:32:54 UTC (rev 417)
@@ -91,7 +91,7 @@
if( !Q_strncmp( name, chunk, 4 ) )
return len;
- len = (len + 1 ) & ~1; // pad to word boundary
+ len = PAD( len, 2 );
// Not the right chunk - skip it
FS_Seek( f, len, FS_SEEK_CUR );
Modified: trunk/code/qcommon/common.c
===================================================================
--- trunk/code/qcommon/common.c 2005-12-05 01:11:41 UTC (rev 416)
+++ trunk/code/qcommon/common.c 2005-12-05 17:32:54 UTC (rev 417)
@@ -929,7 +929,7 @@
//
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 @@
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 );
Modified: trunk/code/qcommon/q_shared.h
===================================================================
--- trunk/code/qcommon/q_shared.h 2005-12-05 01:11:41 UTC (rev 416)
+++ trunk/code/qcommon/q_shared.h 2005-12-05 17:32:54 UTC (rev 417)
@@ -111,8 +111,14 @@
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)
#endif
Modified: trunk/code/renderer/tr_local.h
===================================================================
--- trunk/code/renderer/tr_local.h 2005-12-05 01:11:41 UTC (rev 416)
+++ trunk/code/renderer/tr_local.h 2005-12-05 17:32:54 UTC (rev 417)
@@ -1274,24 +1274,18 @@
} stageVars_t;
-#ifdef __GNUC__
-#define ALIGN16 __attribute__((aligned(16)))
-#else
-#define ALIGN16
-#endif
-
typedef struct shaderCommands_s
{
- glIndex_t indexes[SHADER_MAX_INDEXES] ALIGN16;
- vec4_t xyz[SHADER_MAX_VERTEXES] ALIGN16;
- vec4_t normal[SHADER_MAX_VERTEXES] ALIGN16;
- vec2_t texCoords[SHADER_MAX_VERTEXES][2] ALIGN16;
- color4ub_t vertexColors[SHADER_MAX_VERTEXES] ALIGN16;
- int vertexDlightBits[SHADER_MAX_VERTEXES] ALIGN16;
+ glIndex_t indexes[SHADER_MAX_INDEXES] ALIGN(16);
+ vec4_t xyz[SHADER_MAX_VERTEXES] ALIGN(16);
+ vec4_t normal[SHADER_MAX_VERTEXES] ALIGN(16);
+ vec2_t texCoords[SHADER_MAX_VERTEXES][2] ALIGN(16);
+ color4ub_t vertexColors[SHADER_MAX_VERTEXES] ALIGN(16);
+ int vertexDlightBits[SHADER_MAX_VERTEXES] ALIGN(16);
- stageVars_t svars ALIGN16;
+ stageVars_t svars ALIGN(16);
- color4ub_t constantColor255[SHADER_MAX_VERTEXES] ALIGN16;
+ color4ub_t constantColor255[SHADER_MAX_VERTEXES] ALIGN(16);
shader_t *shader;
float shaderTime;
More information about the quake3-commits
mailing list