Code fixes to support x64.

This commit is contained in:
Artem Kharytoniuk
2014-06-22 19:35:07 +03:00
parent 45f0e016d2
commit eae0ddcccc
13 changed files with 50 additions and 273 deletions

View File

@@ -1003,7 +1003,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;
ID_INLINE void SWAP_DRAW_SURF(void* a, void* b) {
char buf[sizeof(drawSurf_t)];
Com_Memcpy(buf, a, sizeof(drawSurf_t));
Com_Memcpy(a, b, sizeof(drawSurf_t));
Com_Memcpy(b, buf, sizeof(drawSurf_t));
}
/* this parameter defines the cutoff between using quick sort and
insertion sort for arrays; arrays with lengths shorter or equal to the
@@ -1013,7 +1019,6 @@ qsort replacement
static void shortsort( drawSurf_t *lo, drawSurf_t *hi ) {
drawSurf_t *p, *max;
int temp;
while (hi > lo) {
max = lo;
@@ -1044,11 +1049,6 @@ void qsortFast (
unsigned size; /* size of the sub-array */
char *lostk[30], *histk[30];
int stkptr; /* stack for saving sub-array to be processed */
int temp;
if ( sizeof(drawSurf_t) != 8 ) {
ri.Error( ERR_DROP, "change SWAP_DRAW_SURF macro" );
}
/* Note: the number of stack entries required is no more than
1 + log2(size), so 30 is sufficient for any array */