Ludwig's 1st diff: Some 64bit fixes for x86_64. Also fixes Makefile build.

This commit is contained in:
Zachary Slater 2005-08-27 02:24:00 +00:00
parent 59cce31e75
commit f46ede91fb
23 changed files with 150 additions and 84 deletions

View file

@ -87,7 +87,7 @@ void RB_SurfaceAnim( md4Surface_t *surface ) {
}
header = (md4Header_t *)((byte *)surface + surface->ofsHeader);
frameSize = (int)( &((md4Frame_t *)0)->bones[ header->numBones ] );
frameSize = (size_t)( &((md4Frame_t *)0)->bones[ header->numBones ] );
frame = (md4Frame_t *)((byte *)header + header->ofsFrames +
backEnd.currentEntity->e.frame * frameSize );

View file

@ -328,7 +328,7 @@ static void ParseFace( dsurface_t *ds, drawVert_t *verts, msurface_t *surf, int
numIndexes = LittleLong( ds->numIndexes );
// create the srfSurfaceFace_t
sfaceSize = ( int ) &((srfSurfaceFace_t *)0)->points[numPoints];
sfaceSize = ( size_t ) &((srfSurfaceFace_t *)0)->points[numPoints];
ofsIndexes = sfaceSize;
sfaceSize += sizeof( int ) * numIndexes;

View file

@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "tr_local.h"
#include <string.h> // memcpy
trGlobals_t tr;
static float s_flipMatrix[16] = {
@ -1003,7 +1005,13 @@ qsort replacement
=================
*/
#define SWAP_DRAW_SURF(a,b) temp=((int *)a)[0];((int *)a)[0]=((int *)b)[0];((int *)b)[0]=temp; temp=((int *)a)[1];((int *)a)[1]=((int *)b)[1];((int *)b)[1]=temp;
static inline void SWAP_DRAW_SURF(drawSurf_t* a, drawSurf_t* b)
{
drawSurf_t t;
memcpy(&t, a, sizeof(t));
memcpy(a, b, sizeof(t));
memcpy(b, &t, sizeof(t));
}
/* this parameter defines the cutoff between using quick sort and
insertion sort for arrays; arrays with lengths shorter or equal to the
@ -1046,9 +1054,11 @@ void qsortFast (
int stkptr; /* stack for saving sub-array to be processed */
int temp;
#if 0
if ( sizeof(drawSurf_t) != 8 ) {
ri.Error( ERR_DROP, "change SWAP_DRAW_SURF macro" );
}
#endif
/* Note: the number of stack entries required is no more than
1 + log2(size), so 30 is sufficient for any array */

View file

@ -418,7 +418,7 @@ static qboolean R_LoadMD4( model_t *mod, void *buffer, const char *mod_name ) {
// we don't need to swap tags in the renderer, they aren't used
// swap all the frames
frameSize = (int)( &((md4Frame_t *)0)->bones[ md4->numBones ] );
frameSize = (size_t)( &((md4Frame_t *)0)->bones[ md4->numBones ] );
for ( i = 0 ; i < md4->numFrames ; i++, frame++) {
frame = (md4Frame_t *) ( (byte *)md4 + md4->ofsFrames + i * frameSize );
frame->radius = LittleFloat( frame->radius );

View file

@ -43,6 +43,7 @@ static char **shaderTextHashTable[MAX_SHADERTEXT_HASH];
return a hash value for the filename
================
*/
#warning TODO: check if long is ok here
static long generateHashValue( const char *fname, const int size ) {
int i;
long hash;