aboutsummaryrefslogtreecommitdiffstats
path: root/code/renderer/tr_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'code/renderer/tr_main.c')
-rwxr-xr-xcode/renderer/tr_main.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/code/renderer/tr_main.c b/code/renderer/tr_main.c
index 1c92579..54ae106 100755
--- a/code/renderer/tr_main.c
+++ b/code/renderer/tr_main.c
@@ -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 */