Fix warning on Sparc CPU and code cleanup.

This commit is contained in:
Erik de Castro Lopo 2004-05-10 12:57:02 +00:00
parent 276ad91d4b
commit ae3f53694b
2 changed files with 21 additions and 36 deletions

View File

@ -4,6 +4,9 @@
Make sure these programs compile (even though they do nothing) on Win32
and add them to the "make check" target.
* src/sfendian.h
Fix warning on Sparc CPU and code cleanup.
2004-05-09 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/file_io.c

View File

@ -48,56 +48,38 @@
#define LES2H_SHORT(x) (x)
#define LEI2H_INT(x) (x)
#define LES2H_SHORT_PTR(x) ((x) [0] + ((x) [1] << 8))
#define LES2H_INT_PTR(x) (((x) [0] << 16) + ((x) [1] << 24))
#define LET2H_SHORT_PTR(x) ((x) [1] + ((x) [2] << 8))
#define LET2H_INT_PTR(x) (((x) [0] << 8) + ((x) [1] << 16) + ((x) [2] << 24))
#define LEI2H_SHORT_PTR(x) ((x) [2] + ((x) [3] << 8))
#define LEI2H_INT_PTR(x) ((x) [0] + ((x) [1] << 8) + ((x) [2] << 16) + ((x) [3] << 24))
#define BES2H_SHORT(x) ENDSWAP_SHORT(x)
#define BEI2H_INT(x) ENDSWAP_INT(x)
#define BES2H_SHORT_PTR(x) (((x) [0] << 8) + (x) [1])
#define BES2H_INT_PTR(x) (((x) [0] << 24) + ((x) [1] << 16))
#define BET2H_SHORT_PTR(x) (((x) [0] << 8) + (x) [1])
#define BET2H_INT_PTR(x) (((x) [0] << 24) + ((x) [1] << 16) + ((x) [2] << 8))
#define BEI2H_SHORT_PTR(x) (((x) [0] << 8) + (x) [1])
#define BEI2H_INT_PTR(x) (((x) [0] << 24) + ((x) [1] << 16) + ((x) [2] << 8) + (x) [3])
#elif (CPU_IS_BIG_ENDIAN == 1)
#define LES2H_SHORT(x) ENDSWAP_SHORT(x)
#define LEI2H_INT(x) ENDSWAP_INT(x)
#define LES2H_SHORT_PTR(x) ((x) [0] + ((x) [1] << 8))
#define LES2H_INT_PTR(x) (((x) [0] << 16) + ((x) [1] << 24))
#define LET2H_SHORT_PTR(x) ((x) [1] + ((x) [2] << 8))
#define LET2H_INT_PTR(x) (((x) [0] << 8) + ((x) [1] << 16) + ((x) [2] << 24))
#define LEI2H_SHORT_PTR(x) ((x) [2] + ((x) [3] << 8))
#define LEI2H_INT_PTR(x) ((x) [0] + ((x) [1] << 8) + ((x) [2] << 16) + ((x) [3] << 24))
#define BES2H_SHORT(x) (x)
#define BEI2H_INT(x) (x)
#define BES2H_SHORT_PTR(x) (((short*) x) [0])
#define BES2H_INT_PTR(x) ((((short*) x) [0]) << 16)
#define BET2H_SHORT_PTR(x) (((x) [0] << 8) + (x) [1])
#define BET2H_INT_PTR(x) (((x) [0] << 24) + ((x) [1] << 16) + ((x) [2] << 8))
#define BEI2H_SHORT_PTR(x) ((((int*) x) [0]) >> 16)
#define BEI2H_INT_PTR(x) (((int*) x) [0])
#else
#error "Target CPU endian-ness unknown. May need to hand edit src/config.h"
#endif
#define LES2H_SHORT_PTR(x) ((x) [0] + ((x) [1] << 8))
#define LES2H_INT_PTR(x) (((x) [0] << 16) + ((x) [1] << 24))
#define LET2H_SHORT_PTR(x) ((x) [1] + ((x) [2] << 8))
#define LET2H_INT_PTR(x) (((x) [0] << 8) + ((x) [1] << 16) + ((x) [2] << 24))
#define LEI2H_SHORT_PTR(x) ((x) [2] + ((x) [3] << 8))
#define LEI2H_INT_PTR(x) ((x) [0] + ((x) [1] << 8) + ((x) [2] << 16) + ((x) [3] << 24))
#define BES2H_SHORT_PTR(x) (((x) [0] << 8) + (x) [1])
#define BES2H_INT_PTR(x) (((x) [0] << 24) + ((x) [1] << 16))
#define BET2H_SHORT_PTR(x) (((x) [0] << 8) + (x) [1])
#define BET2H_INT_PTR(x) (((x) [0] << 24) + ((x) [1] << 16) + ((x) [2] << 8))
#define BEI2H_SHORT_PTR(x) (((x) [0] << 8) + (x) [1])
#define BEI2H_INT_PTR(x) (((x) [0] << 24) + ((x) [1] << 16) + ((x) [2] << 8) + (x) [3])
/* Endian swapping routines implemented in sfendian.c. */
void endswap_short_array (short *ptr, int len) ;