view test/testendian.c @ 1019:e3b3130f3af8

Date: Fri, 31 Dec 2004 04:14:09 +0900 From: Hayashi Naoyuki Subject: SDL patch for Tru64 UNIX 4.0X SDL-1.2.8 support only Tru64 5.X. This patch is for Tru64 UNIX 4.X.(tested on Tru64 UNIX 4.0G and 5.1B) SDL-1.2.8/configure.in: ld doesn't accept -pthread option. cc -pthread has same effect as -D_REENTRANT when compiling, and has same effect as -lpthread -lexc when linking. SDL-1.2.8/include/begin_code.h: Old Compaq C Compiler accept not inline but __inline. SDL-1.2.8/src/audio/SDL_mixer_MMX.c: SDL-1.2.8/src/audio/SDL_mixer_MMX.h: Old Compaq C Compiler doesn't accept //. SDL-1.2.8/src/cdrom/osf/SDL_syscdrom.c: When becoming Tru64 v5.0 from Tru64 v4.0, the arrangement of the cd-rom device was changed.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 02 Jan 2005 05:05:21 +0000
parents c203b4a42701
children 983df4f9c1c6
line wrap: on
line source


/* Test program to check SDL's CPU endian detection and byte swapping routines */

#include <stdio.h>

#include "SDL.h"
#include "SDL_endian.h"

int main(int argc, char *argv[])
{
	Uint16 value16 = 0xCDAB;
	Uint32 value32 = 0xEFBEADDE;
#if defined(__GNUC__) && defined(SDL_HAS_64BIT_TYPE)
	Uint64 value64 = 0xEFBEADDECDAB3412LL;
#endif

	printf("This is a %s endian machine.\n",
		(SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big");
	printf("Value 16 = 0x%X, swapped = 0x%X\n", value16, SDL_Swap16(value16));
	printf("Value 32 = 0x%X, swapped = 0x%X\n", value32, SDL_Swap32(value32));
#if defined(__GNUC__) && defined(SDL_HAS_64BIT_TYPE)
	printf("Value 64 = 0x%llX, swapped = 0x%llX\n", value64, SDL_Swap64(value64));
#endif
	return(0);
}