diff options
-rw-r--r-- | include/generic.h | 2 | ||||
-rw-r--r-- | lib/Handle.cc | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/include/generic.h b/include/generic.h index e11f518..9097ba0 100644 --- a/include/generic.h +++ b/include/generic.h @@ -13,7 +13,7 @@ #define bcopy(x,y,z) memcpy((y),(x),(z)) #endif -#ifndef SDL_VERSIONNUM +#if ! defined SDL_VERSIONNUM && ! defined Uint32 typedef unsigned long int Uint32; #endif diff --git a/lib/Handle.cc b/lib/Handle.cc index 68f4a7a..255eacd 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -7,8 +7,20 @@ #include "config.h" #endif -#if defined HAVE_BYTESWAP_H && defined WORDS_BIGENDIAN +#include "generic.h" + +#if defined WORDS_BIGENDIAN +#if defined HAVE_BYTESWAP_H #include <byteswap.h> +#else +inline Uint16 bswap_16(Uint16 w) { + return (w >> 8) | (w << 8); +} + +inline Uint32 bswap_32(Uint32 w) { + return (w >> 24) | ((w >> 8) & 0x0000ff00) | ((w << 8) & 0x00ff0000) | (w << 24); +} +#endif #endif #ifdef HAVE_UNISTD_H |