Commit 5c01c479 authored by Sam Lantinga's avatar Sam Lantinga

SDL 1.3 requires a 64-bit type for the platform.

parent da1479c4
This diff is collapsed.
...@@ -198,13 +198,6 @@ if test x$enable_libc = xyes; then ...@@ -198,13 +198,6 @@ if test x$enable_libc = xyes; then
dnl Check for typedefs, structures, etc. dnl Check for typedefs, structures, etc.
AC_TYPE_SIZE_T AC_TYPE_SIZE_T
if test x$ac_cv_header_inttypes_h = xyes -o x$ac_cv_header_stdint_h = xyes; then
AC_CHECK_TYPE(int64_t)
if test x$ac_cv_type_int64_t = xyes; then
AC_DEFINE(SDL_HAS_64BIT_TYPE)
fi
have_inttypes=yes
fi
dnl Check for defines dnl Check for defines
AC_CHECK_DEFINE(M_PI, math.h) AC_CHECK_DEFINE(M_PI, math.h)
...@@ -245,48 +238,6 @@ if test x$enable_libc = xyes; then ...@@ -245,48 +238,6 @@ if test x$enable_libc = xyes; then
fi fi
AC_CHECK_SIZEOF(void*) AC_CHECK_SIZEOF(void*)
if test x$have_inttypes != xyes; then
AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(long long, 8)
if test x$ac_cv_sizeof_char = x1; then
AC_DEFINE(int8_t, signed char)
AC_DEFINE(uint8_t, unsigned char)
fi
if test x$ac_cv_sizeof_short = x2; then
AC_DEFINE(int16_t, signed short)
AC_DEFINE(uint16_t, unsigned short)
else
if test x$ac_cv_sizeof_int = x2; then
AC_DEFINE(int16_t, signed int)
AC_DEFINE(uint16_t, unsigned int)
fi
fi
if test x$ac_cv_sizeof_int = x4; then
AC_DEFINE(int32_t, signed int)
AC_DEFINE(uint32_t, unsigned int)
else
if test x$ac_cv_sizeof_long = x4; then
AC_DEFINE(int32_t, signed long)
AC_DEFINE(uint32_t, unsigned long)
fi
fi
if test x$ac_cv_sizeof_long = x8; then
AC_DEFINE(int64_t, signed long)
AC_DEFINE(uint64_t, unsigned long)
AC_DEFINE(SDL_HAS_64BIT_TYPE)
else
if test x$ac_cv_sizeof_long_long = x8; then
AC_DEFINE(int64_t, signed long long)
AC_DEFINE(uint64_t, unsigned long long)
AC_DEFINE(SDL_HAS_64BIT_TYPE)
fi
fi
AC_DEFINE(size_t, unsigned int)
AC_DEFINE(uintptr_t, unsigned long)
fi
dnl See whether we can use gcc atomic operations on this architecture dnl See whether we can use gcc atomic operations on this architecture
AC_ARG_ENABLE(gcc-atomics, AC_ARG_ENABLE(gcc-atomics,
......
...@@ -43,21 +43,7 @@ ...@@ -43,21 +43,7 @@
#undef volatile #undef volatile
/* C datatypes */ /* C datatypes */
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
#undef size_t
#undef int8_t
#undef uint8_t
#undef int16_t
#undef uint16_t
#undef int32_t
#undef uint32_t
#undef int64_t
#undef uint64_t
#undef uintptr_t
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
#undef SIZEOF_VOIDP #undef SIZEOF_VOIDP
#undef SDL_HAS_64BIT_TYPE
#undef HAVE_GCC_ATOMICS #undef HAVE_GCC_ATOMICS
#undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET
......
...@@ -33,16 +33,6 @@ ...@@ -33,16 +33,6 @@
#include <stdarg.h> #include <stdarg.h>
/*
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
*/
#define HAVE_ALLOCA_H 1 #define HAVE_ALLOCA_H 1
#define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1 #define HAVE_STDIO_H 1
...@@ -115,9 +105,6 @@ typedef unsigned int uint32_t; ...@@ -115,9 +105,6 @@ typedef unsigned int uint32_t;
#define SIZEOF_VOIDP 4 #define SIZEOF_VOIDP 4
typedef unsigned int size_t;
//typedef unsigned long uintptr_t;
/* Enable various audio drivers */ /* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_ANDROID 1 #define SDL_AUDIO_DRIVER_ANDROID 1
#define SDL_AUDIO_DRIVER_DUMMY 1 #define SDL_AUDIO_DRIVER_DUMMY 1
......
...@@ -25,24 +25,12 @@ ...@@ -25,24 +25,12 @@
#include "SDL_platform.h" #include "SDL_platform.h"
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef unsigned long uintptr_t;
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
#ifdef __LP64__ #ifdef __LP64__
#define SIZEOF_VOIDP 8 #define SIZEOF_VOIDP 8
#else #else
#define SIZEOF_VOIDP 4 #define SIZEOF_VOIDP 4
#endif #endif
#define SDL_HAS_64BIT_TYPE 1
#define HAVE_GCC_ATOMICS 1 #define HAVE_GCC_ATOMICS 1
#define HAVE_ALLOCA_H 1 #define HAVE_ALLOCA_H 1
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
#define SIZEOF_VOIDP 4 #define SIZEOF_VOIDP 4
#endif #endif
#define SDL_HAS_64BIT_TYPE 1
/* Useful headers */ /* Useful headers */
/* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */ /* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */
#if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) ) #if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) )
......
...@@ -47,7 +47,6 @@ typedef unsigned long long uint64_t; ...@@ -47,7 +47,6 @@ typedef unsigned long long uint64_t;
typedef unsigned long uintptr_t; typedef unsigned long uintptr_t;
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ #endif /* !_STDINT_H_ && !HAVE_STDINT_H */
#define SDL_HAS_64BIT_TYPE
#ifdef __GNUC__ #ifdef __GNUC__
#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 #define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
#endif #endif
......
...@@ -48,8 +48,6 @@ typedef unsigned __PTRDIFF_TYPE__ uintptr_t; ...@@ -48,8 +48,6 @@ typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
#define SIZEOF_VOIDP 4 #define SIZEOF_VOIDP 4
#define SDL_HAS_64BIT_TYPE 1
/* Useful headers */ /* Useful headers */
#define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1 #define HAVE_STDIO_H 1
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#define SIZEOF_VOIDP 4 #define SIZEOF_VOIDP 4
#endif #endif
#define SDL_HAS_64BIT_TYPE 1
#define SDL_BYTEORDER 1234 #define SDL_BYTEORDER 1234
#define HAVE_ALLOCA_H 1 #define HAVE_ALLOCA_H 1
......
...@@ -76,7 +76,6 @@ typedef unsigned int uintptr_t; ...@@ -76,7 +76,6 @@ typedef unsigned int uintptr_t;
#else #else
# define SIZEOF_VOIDP 4 # define SIZEOF_VOIDP 4
#endif #endif
#define SDL_HAS_64BIT_TYPE 1
/* Enabled for SDL 1.2 (binary compatibility) */ /* Enabled for SDL 1.2 (binary compatibility) */
//#define HAVE_LIBC 1 //#define HAVE_LIBC 1
......
...@@ -28,12 +28,6 @@ ...@@ -28,12 +28,6 @@
/* General platform specific identifiers */ /* General platform specific identifiers */
#include "SDL_platform.h" #include "SDL_platform.h"
/* Make sure that this isn't included by Visual C++ */
#ifdef _MSC_VER
#error You should copy include/SDL_config.h.default to include/SDL_config.h
#endif
#define SDL_HAS_64BIT_TYPE 1
#define SDL_BYTEORDER 1234 #define SDL_BYTEORDER 1234
#define HAVE_ALLOCA_H 1 #define HAVE_ALLOCA_H 1
......
...@@ -153,7 +153,6 @@ SDL_Swap32(Uint32 x) ...@@ -153,7 +153,6 @@ SDL_Swap32(Uint32 x)
} }
#endif #endif
#ifdef SDL_HAS_64BIT_TYPE
#if defined(__GNUC__) && defined(__i386__) #if defined(__GNUC__) && defined(__i386__)
static __inline__ Uint64 static __inline__ Uint64
SDL_Swap64(Uint64 x) SDL_Swap64(Uint64 x)
...@@ -195,14 +194,6 @@ SDL_Swap64(Uint64 x) ...@@ -195,14 +194,6 @@ SDL_Swap64(Uint64 x)
return (x); return (x);
} }
#endif #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.
*/
#define SDL_Swap64(X) (X)
#endif /* SDL_HAS_64BIT_TYPE */
static __inline__ float static __inline__ float
......
...@@ -144,22 +144,14 @@ typedef int32_t Sint32; ...@@ -144,22 +144,14 @@ typedef int32_t Sint32;
*/ */
typedef uint32_t Uint32; typedef uint32_t Uint32;
#ifdef SDL_HAS_64BIT_TYPE
/** /**
* \brief A signed 64-bit integer type. * \brief A signed 64-bit integer type.
* \warning On platforms without any sort of 64-bit datatype, this is equivalent to Sint32!
*/ */
typedef int64_t Sint64; typedef int64_t Sint64;
/** /**
* \brief An unsigned 64-bit integer type. * \brief An unsigned 64-bit integer type.
* \warning On platforms without any sort of 64-bit datatype, this is equivalent to Uint32!
*/ */
typedef uint64_t Uint64; typedef uint64_t Uint64;
#else
/* This is really just a hack to prevent the compiler from complaining */
typedef Sint32 Sint64;
typedef Uint32 Uint64;
#endif
/*@}*//*Basic data types*/ /*@}*//*Basic data types*/
...@@ -174,10 +166,8 @@ SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); ...@@ -174,10 +166,8 @@ SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
#ifdef SDL_HAS_64BIT_TYPE
SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
#endif
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
/** \endcond */ /** \endcond */
...@@ -545,8 +535,6 @@ extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, ...@@ -545,8 +535,6 @@ extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string,
char **endp, int base); char **endp, int base);
#endif #endif
#ifdef SDL_HAS_64BIT_TYPE
#ifdef HAVE__I64TOA #ifdef HAVE__I64TOA
#define SDL_lltoa _i64toa #define SDL_lltoa _i64toa
#else #else
...@@ -575,8 +563,6 @@ extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, ...@@ -575,8 +563,6 @@ extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp,
int base); int base);
#endif #endif
#endif /* SDL_HAS_64BIT_TYPE */
#ifdef HAVE_STRTOD #ifdef HAVE_STRTOD
#define SDL_strtod strtod #define SDL_strtod strtod
#else #else
......
...@@ -149,7 +149,6 @@ SDL_ScanUintPtrT(const char *text, int radix, uintptr_t * valuep) ...@@ -149,7 +149,6 @@ SDL_ScanUintPtrT(const char *text, int radix, uintptr_t * valuep)
} }
#endif #endif
#ifdef SDL_HAS_64BIT_TYPE
#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOLL) #if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOLL)
static size_t static size_t
SDL_ScanLongLong(const char *text, int radix, Sint64 * valuep) SDL_ScanLongLong(const char *text, int radix, Sint64 * valuep)
...@@ -222,7 +221,6 @@ SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 * valuep) ...@@ -222,7 +221,6 @@ SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 * valuep)
return (text - textstart); return (text - textstart);
} }
#endif #endif
#endif /* SDL_HAS_64BIT_TYPE */
#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOD) #if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOD)
static size_t static size_t
...@@ -679,8 +677,6 @@ SDL_strtoul(const char *string, char **endp, int base) ...@@ -679,8 +677,6 @@ SDL_strtoul(const char *string, char **endp, int base)
} }
#endif #endif
#ifdef SDL_HAS_64BIT_TYPE
#ifndef HAVE__I64TOA #ifndef HAVE__I64TOA
char * char *
SDL_lltoa(Sint64 value, char *string, int radix) SDL_lltoa(Sint64 value, char *string, int radix)
...@@ -781,8 +777,6 @@ SDL_strtoull(const char *string, char **endp, int base) ...@@ -781,8 +777,6 @@ SDL_strtoull(const char *string, char **endp, int base)
} }
#endif #endif
#endif /* SDL_HAS_64BIT_TYPE */
#ifndef HAVE_STRTOD #ifndef HAVE_STRTOD
double double
SDL_strtod(const char *string, char **endp) SDL_strtod(const char *string, char **endp)
...@@ -976,7 +970,6 @@ SDL_sscanf(const char *text, const char *fmt, ...) ...@@ -976,7 +970,6 @@ SDL_sscanf(const char *text, const char *fmt, ...)
} }
/* Fall through to %d handling */ /* Fall through to %d handling */
case 'd': case 'd':
#ifdef SDL_HAS_64BIT_TYPE
if (inttype == DO_LONGLONG) { if (inttype == DO_LONGLONG) {
Sint64 value; Sint64 value;
text += SDL_ScanLongLong(text, radix, &value); text += SDL_ScanLongLong(text, radix, &value);
...@@ -985,9 +978,7 @@ SDL_sscanf(const char *text, const char *fmt, ...) ...@@ -985,9 +978,7 @@ SDL_sscanf(const char *text, const char *fmt, ...)
*valuep = value; *valuep = value;
++retval; ++retval;
} }
} else } else {
#endif /* SDL_HAS_64BIT_TYPE */
{
long value; long value;
text += SDL_ScanLong(text, radix, &value); text += SDL_ScanLong(text, radix, &value);
if (!suppress) { if (!suppress) {
...@@ -1031,7 +1022,6 @@ SDL_sscanf(const char *text, const char *fmt, ...) ...@@ -1031,7 +1022,6 @@ SDL_sscanf(const char *text, const char *fmt, ...)
} }
/* Fall through to unsigned handling */ /* Fall through to unsigned handling */
case 'u': case 'u':
#ifdef SDL_HAS_64BIT_TYPE
if (inttype == DO_LONGLONG) { if (inttype == DO_LONGLONG) {
Uint64 value; Uint64 value;
text += SDL_ScanUnsignedLongLong(text, radix, &value); text += SDL_ScanUnsignedLongLong(text, radix, &value);
...@@ -1040,9 +1030,7 @@ SDL_sscanf(const char *text, const char *fmt, ...) ...@@ -1040,9 +1030,7 @@ SDL_sscanf(const char *text, const char *fmt, ...)
*valuep = value; *valuep = value;
++retval; ++retval;
} }
} else } else {
#endif /* SDL_HAS_64BIT_TYPE */
{
unsigned long value; unsigned long value;
text += SDL_ScanUnsignedLong(text, radix, &value); text += SDL_ScanUnsignedLong(text, radix, &value);
if (!suppress) { if (!suppress) {
...@@ -1194,7 +1182,6 @@ SDL_PrintUnsignedLong(char *text, unsigned long value, int radix, ...@@ -1194,7 +1182,6 @@ SDL_PrintUnsignedLong(char *text, unsigned long value, int radix,
return size; return size;
} }
#ifdef SDL_HAS_64BIT_TYPE
static size_t static size_t
SDL_PrintLongLong(char *text, Sint64 value, int radix, size_t maxlen) SDL_PrintLongLong(char *text, Sint64 value, int radix, size_t maxlen)
{ {
...@@ -1226,7 +1213,7 @@ SDL_PrintUnsignedLongLong(char *text, Uint64 value, int radix, size_t maxlen) ...@@ -1226,7 +1213,7 @@ SDL_PrintUnsignedLongLong(char *text, Uint64 value, int radix, size_t maxlen)
return size; return size;
} }
#endif /* SDL_HAS_64BIT_TYPE */
static size_t static size_t
SDL_PrintFloat(char *text, double arg, size_t maxlen) SDL_PrintFloat(char *text, double arg, size_t maxlen)
{ {
...@@ -1343,16 +1330,10 @@ SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap) ...@@ -1343,16 +1330,10 @@ SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap)
radix, maxlen); radix, maxlen);
break; break;
case DO_LONGLONG: case DO_LONGLONG:
#ifdef SDL_HAS_64BIT_TYPE
len = len =
SDL_PrintLongLong(text, SDL_PrintLongLong(text,
va_arg(ap, Sint64), va_arg(ap, Sint64),
radix, maxlen); radix, maxlen);
#else
len =
SDL_PrintLong(text, va_arg(ap, long),
radix, maxlen);
#endif
break; break;
} }
done = SDL_TRUE; done = SDL_TRUE;
...@@ -1392,20 +1373,11 @@ SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap) ...@@ -1392,20 +1373,11 @@ SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap)
radix, maxlen); radix, maxlen);
break; break;
case DO_LONGLONG: case DO_LONGLONG:
#ifdef SDL_HAS_64BIT_TYPE
len = len =
SDL_PrintUnsignedLongLong(text, SDL_PrintUnsignedLongLong(text,
va_arg(ap, va_arg(ap,
Uint64), Uint64),
radix, maxlen); radix, maxlen);
#else
len =
SDL_PrintUnsignedLong(text,
va_arg(ap,
unsigned
long),
radix, maxlen);
#endif
break; break;
} }
if (do_lowercase) { if (do_lowercase) {
......
...@@ -58,11 +58,9 @@ static void plat_testTypes (void) ...@@ -58,11 +58,9 @@ static void plat_testTypes (void)
if (SDL_ATvassert( ret == 0, "sizeof(Uint32) = %lu instead of 4", sizeof(Uint32) )) if (SDL_ATvassert( ret == 0, "sizeof(Uint32) = %lu instead of 4", sizeof(Uint32) ))
return; return;
#ifdef SDL_HAS_64BIT_TYPE
ret = plat_testSize( sizeof(Uint64), 8 ); ret = plat_testSize( sizeof(Uint64), 8 );
if (SDL_ATvassert( ret == 0, "sizeof(Uint64) = %lu instead of 8", sizeof(Uint64) )) if (SDL_ATvassert( ret == 0, "sizeof(Uint64) = %lu instead of 8", sizeof(Uint64) ))
return; return;
#endif /* SDL_HAS_64BIT_TYPE */
SDL_ATend(); SDL_ATend();
} }
...@@ -79,7 +77,7 @@ static void plat_testEndian (void) ...@@ -79,7 +77,7 @@ static void plat_testEndian (void)
Uint16 swapped16 = 0xABCD; Uint16 swapped16 = 0xABCD;
Uint32 value32 = 0xEFBEADDE; Uint32 value32 = 0xEFBEADDE;
Uint32 swapped32 = 0xDEADBEEF; Uint32 swapped32 = 0xDEADBEEF;
#ifdef SDL_HAS_64BIT_TYPE
Uint64 value64, swapped64; Uint64 value64, swapped64;
value64 = 0xEFBEADDE; value64 = 0xEFBEADDE;
value64 <<= 32; value64 <<= 32;
...@@ -87,7 +85,6 @@ static void plat_testEndian (void) ...@@ -87,7 +85,6 @@ static void plat_testEndian (void)
swapped64 = 0x1234ABCD; swapped64 = 0x1234ABCD;
swapped64 <<= 32; swapped64 <<= 32;
swapped64 |= 0xDEADBEEF; swapped64 |= 0xDEADBEEF;
#endif
SDL_ATbegin( "Endianness" ); SDL_ATbegin( "Endianness" );
...@@ -115,7 +112,6 @@ static void plat_testEndian (void) ...@@ -115,7 +112,6 @@ static void plat_testEndian (void)
value32, SDL_Swap32(value32) )) value32, SDL_Swap32(value32) ))
return; return;
#ifdef SDL_HAS_64BIT_TYPE
/* Test 64 swap. */ /* Test 64 swap. */
if (SDL_ATvassert( SDL_Swap64(value64) == swapped64, if (SDL_ATvassert( SDL_Swap64(value64) == swapped64,
#ifdef _MSC_VER #ifdef _MSC_VER
...@@ -125,7 +121,6 @@ static void plat_testEndian (void) ...@@ -125,7 +121,6 @@ static void plat_testEndian (void)
#endif #endif
value64, SDL_Swap64(value64) )) value64, SDL_Swap64(value64) ))
return; return;
#endif
SDL_ATend(); SDL_ATend();
} }
......
...@@ -40,18 +40,12 @@ TestTypes(SDL_bool verbose) ...@@ -40,18 +40,12 @@ TestTypes(SDL_bool verbose)
(unsigned int)sizeof(Uint32)); (unsigned int)sizeof(Uint32));
++error; ++error;
} }
#ifdef SDL_HAS_64BIT_TYPE
if (badsize(sizeof(Uint64), 8)) { if (badsize(sizeof(Uint64), 8)) {
if (verbose) if (verbose)
printf("sizeof(Uint64) != 8, instead = %u\n", printf("sizeof(Uint64) != 8, instead = %u\n",
(unsigned int)sizeof(Uint64)); (unsigned int)sizeof(Uint64));
++error; ++error;
} }
#else
if (verbose) {
printf("WARNING: No 64-bit datatype on this platform\n");
}
#endif
if (verbose && !error) if (verbose && !error)
printf("All data types are the expected size.\n"); printf("All data types are the expected size.\n");
...@@ -68,15 +62,14 @@ TestEndian(SDL_bool verbose) ...@@ -68,15 +62,14 @@ TestEndian(SDL_bool verbose)
Uint16 swapped16 = 0xABCD; Uint16 swapped16 = 0xABCD;
Uint32 value32 = 0xEFBEADDE; Uint32 value32 = 0xEFBEADDE;
Uint32 swapped32 = 0xDEADBEEF; Uint32 swapped32 = 0xDEADBEEF;
#ifdef SDL_HAS_64BIT_TYPE
Uint64 value64, swapped64; Uint64 value64, swapped64;
value64 = 0xEFBEADDE; value64 = 0xEFBEADDE;
value64 <<= 32; value64 <<= 32;
value64 |= 0xCDAB3412; value64 |= 0xCDAB3412;
swapped64 = 0x1234ABCD; swapped64 = 0x1234ABCD;
swapped64 <<= 32; swapped64 <<= 32;
swapped64 |= 0xDEADBEEF; swapped64 |= 0xDEADBEEF;
#endif
if (verbose) { if (verbose) {
printf("Detected a %s endian machine.\n", printf("Detected a %s endian machine.\n",
...@@ -114,7 +107,6 @@ TestEndian(SDL_bool verbose) ...@@ -114,7 +107,6 @@ TestEndian(SDL_bool verbose)
} }
++error; ++error;
} }
#ifdef SDL_HAS_64BIT_TYPE
if (verbose) { if (verbose) {
#ifdef _MSC_VER #ifdef _MSC_VER
printf("Value 64 = 0x%I64X, swapped = 0x%I64X\n", value64, printf("Value 64 = 0x%I64X, swapped = 0x%I64X\n", value64,
...@@ -130,7 +122,6 @@ TestEndian(SDL_bool verbose) ...@@ -130,7 +122,6 @@ TestEndian(SDL_bool verbose)
} }
++error; ++error;
} }
#endif
return (error ? 1 : 0); return (error ? 1 : 0);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment