test/testendian.c
changeset 850 c203b4a42701
child 1405 983df4f9c1c6
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/testendian.c	Mon Feb 23 08:03:14 2004 +0000
     1.3 @@ -0,0 +1,25 @@
     1.4 +
     1.5 +/* Test program to check SDL's CPU endian detection and byte swapping routines */
     1.6 +
     1.7 +#include <stdio.h>
     1.8 +
     1.9 +#include "SDL.h"
    1.10 +#include "SDL_endian.h"
    1.11 +
    1.12 +int main(int argc, char *argv[])
    1.13 +{
    1.14 +	Uint16 value16 = 0xCDAB;
    1.15 +	Uint32 value32 = 0xEFBEADDE;
    1.16 +#if defined(__GNUC__) && defined(SDL_HAS_64BIT_TYPE)
    1.17 +	Uint64 value64 = 0xEFBEADDECDAB3412LL;
    1.18 +#endif
    1.19 +
    1.20 +	printf("This is a %s endian machine.\n",
    1.21 +		(SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big");
    1.22 +	printf("Value 16 = 0x%X, swapped = 0x%X\n", value16, SDL_Swap16(value16));
    1.23 +	printf("Value 32 = 0x%X, swapped = 0x%X\n", value32, SDL_Swap32(value32));
    1.24 +#if defined(__GNUC__) && defined(SDL_HAS_64BIT_TYPE)
    1.25 +	printf("Value 64 = 0x%llX, swapped = 0x%llX\n", value64, SDL_Swap64(value64));
    1.26 +#endif
    1.27 +	return(0);
    1.28 +}