]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/ddslib/ddslib.c
Merge commit 'bf6dd1f2d186c799adf11f1e744a1ff57aa8d335' into garux-merge
[xonotic/netradiant.git] / libs / ddslib / ddslib.c
index 43a1f913fed04475962eaff96386b8bcf3e7725d..15dbef80a25172fe9d28b5dfae800dc1fb128dd8 100644 (file)
 
    ----------------------------------------------------------------------------- */
 
-
-
-/* marker */
-#define DDSLIB_C
-
-
-
 /* dependencies */
 #include "ddslib.h"
-
-
+#include "globaldefs.h"
 
 /* endian tomfoolery */
 typedef union
@@ -55,15 +47,7 @@ typedef union
 }
 floatSwapUnion;
 
-
-#ifndef __BIG_ENDIAN__
-       #ifdef _SGI_SOURCE
-               #define __BIG_ENDIAN__
-       #endif
-#endif
-
-
-#ifdef __BIG_ENDIAN__
+#if GDEF_ARCH_ENDIAN_BIG
 
 int   DDSBigLong( int src ) { return src; }
 short DDSBigShort( short src ) { return src; }
@@ -521,7 +505,7 @@ static int DDSDecompressDXT1( ddsBuffer_t *dds, int width, int height, unsigned
        for ( y = 0; y < yBlocks; y++ )
        {
                /* 8 bytes per block */
-               block = (ddsColorBlock_t*) ( (size_t) dds->data + y * xBlocks * 8 );
+               block = (ddsColorBlock_t*) ( (char *) dds->data + y * xBlocks * 8 );
 
                /* walk x */
                for ( x = 0; x < xBlocks; x++, block++ )
@@ -566,7 +550,7 @@ static int DDSDecompressDXT3( ddsBuffer_t *dds, int width, int height, unsigned
        for ( y = 0; y < yBlocks; y++ )
        {
                /* 8 bytes per block, 1 block for alpha, 1 block for color */
-               block = (ddsColorBlock_t*) ( (size_t) dds->data + y * xBlocks * 16 );
+               block = (ddsColorBlock_t*) ( (char *) dds->data + y * xBlocks * 16 );
 
                /* walk x */
                for ( x = 0; x < xBlocks; x++, block++ )
@@ -621,7 +605,7 @@ static int DDSDecompressDXT5( ddsBuffer_t *dds, int width, int height, unsigned
        for ( y = 0; y < yBlocks; y++ )
        {
                /* 8 bytes per block, 1 block for alpha, 1 block for color */
-               block = (ddsColorBlock_t*) ( (size_t) dds->data + y * xBlocks * 16 );
+               block = (ddsColorBlock_t*) ( (char *) dds->data + y * xBlocks * 16 );
 
                /* walk x */
                for ( x = 0; x < xBlocks; x++, block++ )