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

@ -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 */