mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-10 14:52:00 +00:00
* Replaced ALIGN macro with PAD
* Moved ALIGN16 macro from tr_local.h to ALIGN in q_shared.h
This commit is contained in:
parent
cfdd586ef8
commit
1704eecc52
6 changed files with 25 additions and 24 deletions
|
@ -521,7 +521,8 @@ void AAS_CalculateAreaTravelTimes(void)
|
|||
//
|
||||
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 @@ void AAS_CalculateAreaTravelTimes(void)
|
|||
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];
|
||||
//
|
||||
|
|
|
@ -690,7 +690,7 @@ bot_synonymlist_t *BotLoadSynonyms(char *filename)
|
|||
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 @@ bot_randomlist_t *BotLoadRandomStrings(char *filename)
|
|||
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 @@ bot_randomlist_t *BotLoadRandomStrings(char *filename)
|
|||
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 @@ bot_chat_t *BotLoadInitialChat(char *chatfile, char *chatname)
|
|||
return NULL;
|
||||
} //end if
|
||||
len = strlen(chatmessagestring) + 1;
|
||||
len = ALIGN(len);
|
||||
len = PAD(len, sizeof(long));
|
||||
if (pass)
|
||||
{
|
||||
chatmessage = (bot_chatmessage_t *) ptr;
|
||||
|
|
|
@ -91,7 +91,7 @@ static int S_FindRIFFChunk( fileHandle_t f, char *chunk ) {
|
|||
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 );
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1274,24 +1274,18 @@ typedef struct stageVars
|
|||
} 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;
|
||||
|
|
Loading…
Reference in a new issue