From 3e8753057670d8970c086f8344afe0979191b397 Mon Sep 17 00:00:00 2001 From: tma Date: Sun, 25 Oct 2009 23:07:11 +0000 Subject: * Update SDL headers and win32 libs to 1.2.14 git-svn-id: svn://svn.icculus.org/quake3/trunk@1707 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/SDL12/include/SDL_endian.h | 53 +++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 18 deletions(-) (limited to 'code/SDL12/include/SDL_endian.h') diff --git a/code/SDL12/include/SDL_endian.h b/code/SDL12/include/SDL_endian.h index 6257a64..f7a2e2f 100644 --- a/code/SDL12/include/SDL_endian.h +++ b/code/SDL12/include/SDL_endian.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2006 Sam Lantinga + Copyright (C) 1997-2009 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,23 @@ slouken@libsdl.org */ -/* Functions for reading and writing endian-specific values */ +/** + * @file SDL_endian.h + * Functions for reading and writing endian-specific values + */ #ifndef _SDL_endian_h #define _SDL_endian_h #include "SDL_stdinc.h" -/* The two types of endianness */ +/** @name SDL_ENDIANs + * The two types of endianness + */ +/*@{*/ #define SDL_LIL_ENDIAN 1234 #define SDL_BIG_ENDIAN 4321 +/*@}*/ #ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */ #if defined(__hppa__) || \ @@ -50,13 +57,16 @@ extern "C" { #endif -/* Use inline functions for compilers that support them, and static - functions for those that do not. Because these functions become - static for compilers that do not support inline functions, this - header should only be included in files that actually use them. -*/ +/** + * @name SDL_Swap Functions + * Use inline functions for compilers that support them, and static + * functions for those that do not. Because these functions become + * static for compilers that do not support inline functions, this + * header should only be included in files that actually use them. + */ +/*@{*/ #if defined(__GNUC__) && defined(__i386__) && \ - !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */) + !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */) static __inline__ Uint16 SDL_Swap16(Uint16 x) { __asm__("xchgb %b0,%h0" : "=q" (x) : "0" (x)); @@ -88,7 +98,8 @@ static __inline__ Uint16 SDL_Swap16(Uint16 x) { } #endif -#if defined(__GNUC__) && defined(__i386__) +#if defined(__GNUC__) && defined(__i386__) && \ + !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */) static __inline__ Uint32 SDL_Swap32(Uint32 x) { __asm__("bswap %0" : "=r" (x) : "0" (x)); @@ -123,7 +134,8 @@ static __inline__ Uint32 SDL_Swap32(Uint32 x) { #endif #ifdef SDL_HAS_64BIT_TYPE -#if defined(__GNUC__) && defined(__i386__) +#if defined(__GNUC__) && defined(__i386__) && \ + !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */) static __inline__ Uint64 SDL_Swap64(Uint64 x) { union { @@ -148,9 +160,9 @@ static __inline__ Uint64 SDL_Swap64(Uint64 x) Uint32 hi, lo; /* Separate into high and low 32-bit values and swap them */ - lo = (Uint32)(x&0xFFFFFFFF); + lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF); x >>= 32; - hi = (Uint32)(x&0xFFFFFFFF); + hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF); x = SDL_Swap32(lo); x <<= 32; x |= SDL_Swap32(hi); @@ -159,14 +171,18 @@ static __inline__ Uint64 SDL_Swap64(Uint64 x) #endif #else /* This is mainly to keep compilers from complaining in SDL code. - If there is no real 64-bit datatype, then compilers will complain about - the fake 64-bit datatype that SDL provides when it compiles user code. -*/ + * If there is no real 64-bit datatype, then compilers will complain about + * the fake 64-bit datatype that SDL provides when it compiles user code. + */ #define SDL_Swap64(X) (X) #endif /* SDL_HAS_64BIT_TYPE */ +/*@}*/ - -/* Byteswap item from the specified endianness to the native endianness */ +/** + * @name SDL_SwapLE and SDL_SwapBE Functions + * Byteswap item from the specified endianness to the native endianness + */ +/*@{*/ #if SDL_BYTEORDER == SDL_LIL_ENDIAN #define SDL_SwapLE16(X) (X) #define SDL_SwapLE32(X) (X) @@ -182,6 +198,7 @@ static __inline__ Uint64 SDL_Swap64(Uint64 x) #define SDL_SwapBE32(X) (X) #define SDL_SwapBE64(X) (X) #endif +/*@}*/ /* Ends C function definitions when using C++ */ #ifdef __cplusplus -- cgit v1.2.3