Mercurial > sdl-ios-xcode
view test/testendian.c @ 908:6104bfff77ba
Date: Mon, 28 Jun 2004 19:58:08 +0900
From: Hayashi Naoyuki
Subject: SDL_types.h - fix for Tru64 MME
The following two problems are fixed.
1. Type of Uint64 is "long long" in SDL_types.h,
but is "long" in mmbasic.h(Tru64 UNIX MME header file).
2. Uint8, Uint16 and Uint32 are redefined
if you compile a file including mmbasic.h and SDL_types.h.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 18 Jul 2004 19:42:03 +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); }