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

This commit is contained in:
Sam Lantinga 2011-03-25 13:47:49 -07:00
parent da1479c45f
commit 5c01c4797c
16 changed files with 5 additions and 2350 deletions

2179
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -198,13 +198,6 @@ if test x$enable_libc = xyes; then
dnl Check for typedefs, structures, etc.
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
AC_CHECK_DEFINE(M_PI, math.h)
@ -245,48 +238,6 @@ if test x$enable_libc = xyes; then
fi
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
AC_ARG_ENABLE(gcc-atomics,

View File

@ -43,21 +43,7 @@
#undef volatile
/* 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 SDL_HAS_64BIT_TYPE
#undef HAVE_GCC_ATOMICS
#undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET

View File

@ -33,16 +33,6 @@
#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_SYS_TYPES_H 1
#define HAVE_STDIO_H 1
@ -115,9 +105,6 @@ typedef unsigned int uint32_t;
#define SIZEOF_VOIDP 4
typedef unsigned int size_t;
//typedef unsigned long uintptr_t;
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_ANDROID 1
#define SDL_AUDIO_DRIVER_DUMMY 1

View File

@ -25,24 +25,12 @@
#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__
#define SIZEOF_VOIDP 8
#else
#define SIZEOF_VOIDP 4
#endif
#define SDL_HAS_64BIT_TYPE 1
#define HAVE_GCC_ATOMICS 1
#define HAVE_ALLOCA_H 1

View File

@ -36,8 +36,6 @@
#define SIZEOF_VOIDP 4
#endif
#define SDL_HAS_64BIT_TYPE 1
/* Useful headers */
/* 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__)) )

View File

@ -47,7 +47,6 @@ typedef unsigned long long uint64_t;
typedef unsigned long uintptr_t;
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
#define SDL_HAS_64BIT_TYPE
#ifdef __GNUC__
#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
#endif

View File

@ -48,8 +48,6 @@ typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
#define SIZEOF_VOIDP 4
#define SDL_HAS_64BIT_TYPE 1
/* Useful headers */
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1

View File

@ -34,7 +34,6 @@
#define SIZEOF_VOIDP 4
#endif
#define SDL_HAS_64BIT_TYPE 1
#define SDL_BYTEORDER 1234
#define HAVE_ALLOCA_H 1

View File

@ -76,7 +76,6 @@ typedef unsigned int uintptr_t;
#else
# define SIZEOF_VOIDP 4
#endif
#define SDL_HAS_64BIT_TYPE 1
/* Enabled for SDL 1.2 (binary compatibility) */
//#define HAVE_LIBC 1

View File

@ -28,12 +28,6 @@
/* General platform specific identifiers */
#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 HAVE_ALLOCA_H 1

View File

@ -153,7 +153,6 @@ SDL_Swap32(Uint32 x)
}
#endif
#ifdef SDL_HAS_64BIT_TYPE
#if defined(__GNUC__) && defined(__i386__)
static __inline__ Uint64
SDL_Swap64(Uint64 x)
@ -195,14 +194,6 @@ SDL_Swap64(Uint64 x)
return (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.
*/
#define SDL_Swap64(X) (X)
#endif /* SDL_HAS_64BIT_TYPE */
static __inline__ float

View File

@ -144,22 +144,14 @@ typedef int32_t Sint32;
*/
typedef uint32_t Uint32;
#ifdef SDL_HAS_64BIT_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;
/**
* \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;
#else
/* This is really just a hack to prevent the compiler from complaining */
typedef Sint32 Sint64;
typedef Uint32 Uint64;
#endif
/*@}*//*Basic data types*/
@ -174,10 +166,8 @@ SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 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(sint64, sizeof(Sint64) == 8);
#endif
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
/** \endcond */
@ -545,8 +535,6 @@ extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string,
char **endp, int base);
#endif
#ifdef SDL_HAS_64BIT_TYPE
#ifdef HAVE__I64TOA
#define SDL_lltoa _i64toa
#else
@ -575,8 +563,6 @@ extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp,
int base);
#endif
#endif /* SDL_HAS_64BIT_TYPE */
#ifdef HAVE_STRTOD
#define SDL_strtod strtod
#else

View File

@ -149,7 +149,6 @@ SDL_ScanUintPtrT(const char *text, int radix, uintptr_t * valuep)
}
#endif
#ifdef SDL_HAS_64BIT_TYPE
#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOLL)
static size_t
SDL_ScanLongLong(const char *text, int radix, Sint64 * valuep)
@ -222,7 +221,6 @@ SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 * valuep)
return (text - textstart);
}
#endif
#endif /* SDL_HAS_64BIT_TYPE */
#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOD)
static size_t
@ -679,8 +677,6 @@ SDL_strtoul(const char *string, char **endp, int base)
}
#endif
#ifdef SDL_HAS_64BIT_TYPE
#ifndef HAVE__I64TOA
char *
SDL_lltoa(Sint64 value, char *string, int radix)
@ -781,8 +777,6 @@ SDL_strtoull(const char *string, char **endp, int base)
}
#endif
#endif /* SDL_HAS_64BIT_TYPE */
#ifndef HAVE_STRTOD
double
SDL_strtod(const char *string, char **endp)
@ -976,7 +970,6 @@ SDL_sscanf(const char *text, const char *fmt, ...)
}
/* Fall through to %d handling */
case 'd':
#ifdef SDL_HAS_64BIT_TYPE
if (inttype == DO_LONGLONG) {
Sint64 value;
text += SDL_ScanLongLong(text, radix, &value);
@ -985,9 +978,7 @@ SDL_sscanf(const char *text, const char *fmt, ...)
*valuep = value;
++retval;
}
} else
#endif /* SDL_HAS_64BIT_TYPE */
{
} else {
long value;
text += SDL_ScanLong(text, radix, &value);
if (!suppress) {
@ -1031,7 +1022,6 @@ SDL_sscanf(const char *text, const char *fmt, ...)
}
/* Fall through to unsigned handling */
case 'u':
#ifdef SDL_HAS_64BIT_TYPE
if (inttype == DO_LONGLONG) {
Uint64 value;
text += SDL_ScanUnsignedLongLong(text, radix, &value);
@ -1040,9 +1030,7 @@ SDL_sscanf(const char *text, const char *fmt, ...)
*valuep = value;
++retval;
}
} else
#endif /* SDL_HAS_64BIT_TYPE */
{
} else {
unsigned long value;
text += SDL_ScanUnsignedLong(text, radix, &value);
if (!suppress) {
@ -1194,7 +1182,6 @@ SDL_PrintUnsignedLong(char *text, unsigned long value, int radix,
return size;
}
#ifdef SDL_HAS_64BIT_TYPE
static size_t
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)
return size;
}
#endif /* SDL_HAS_64BIT_TYPE */
static size_t
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)
radix, maxlen);
break;
case DO_LONGLONG:
#ifdef SDL_HAS_64BIT_TYPE
len =
SDL_PrintLongLong(text,
va_arg(ap, Sint64),
radix, maxlen);
#else
len =
SDL_PrintLong(text, va_arg(ap, long),
radix, maxlen);
#endif
break;
}
done = SDL_TRUE;
@ -1392,20 +1373,11 @@ SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap)
radix, maxlen);
break;
case DO_LONGLONG:
#ifdef SDL_HAS_64BIT_TYPE
len =
SDL_PrintUnsignedLongLong(text,
va_arg(ap,
Uint64),
radix, maxlen);
#else
len =
SDL_PrintUnsignedLong(text,
va_arg(ap,
unsigned
long),
radix, maxlen);
#endif
break;
}
if (do_lowercase) {

View File

@ -58,11 +58,9 @@ static void plat_testTypes (void)
if (SDL_ATvassert( ret == 0, "sizeof(Uint32) = %lu instead of 4", sizeof(Uint32) ))
return;
#ifdef SDL_HAS_64BIT_TYPE
ret = plat_testSize( sizeof(Uint64), 8 );
if (SDL_ATvassert( ret == 0, "sizeof(Uint64) = %lu instead of 8", sizeof(Uint64) ))
return;
#endif /* SDL_HAS_64BIT_TYPE */
SDL_ATend();
}
@ -79,7 +77,7 @@ static void plat_testEndian (void)
Uint16 swapped16 = 0xABCD;
Uint32 value32 = 0xEFBEADDE;
Uint32 swapped32 = 0xDEADBEEF;
#ifdef SDL_HAS_64BIT_TYPE
Uint64 value64, swapped64;
value64 = 0xEFBEADDE;
value64 <<= 32;
@ -87,7 +85,6 @@ static void plat_testEndian (void)
swapped64 = 0x1234ABCD;
swapped64 <<= 32;
swapped64 |= 0xDEADBEEF;
#endif
SDL_ATbegin( "Endianness" );
@ -115,7 +112,6 @@ static void plat_testEndian (void)
value32, SDL_Swap32(value32) ))
return;
#ifdef SDL_HAS_64BIT_TYPE
/* Test 64 swap. */
if (SDL_ATvassert( SDL_Swap64(value64) == swapped64,
#ifdef _MSC_VER
@ -125,7 +121,6 @@ static void plat_testEndian (void)
#endif
value64, SDL_Swap64(value64) ))
return;
#endif
SDL_ATend();
}

View File

@ -40,18 +40,12 @@ TestTypes(SDL_bool verbose)
(unsigned int)sizeof(Uint32));
++error;
}
#ifdef SDL_HAS_64BIT_TYPE
if (badsize(sizeof(Uint64), 8)) {
if (verbose)
printf("sizeof(Uint64) != 8, instead = %u\n",
(unsigned int)sizeof(Uint64));
++error;
}
#else
if (verbose) {
printf("WARNING: No 64-bit datatype on this platform\n");
}
#endif
if (verbose && !error)
printf("All data types are the expected size.\n");
@ -68,15 +62,14 @@ TestEndian(SDL_bool verbose)
Uint16 swapped16 = 0xABCD;
Uint32 value32 = 0xEFBEADDE;
Uint32 swapped32 = 0xDEADBEEF;
#ifdef SDL_HAS_64BIT_TYPE
Uint64 value64, swapped64;
value64 = 0xEFBEADDE;
value64 <<= 32;
value64 |= 0xCDAB3412;
swapped64 = 0x1234ABCD;
swapped64 <<= 32;
swapped64 |= 0xDEADBEEF;
#endif
if (verbose) {
printf("Detected a %s endian machine.\n",
@ -114,7 +107,6 @@ TestEndian(SDL_bool verbose)
}
++error;
}
#ifdef SDL_HAS_64BIT_TYPE
if (verbose) {
#ifdef _MSC_VER
printf("Value 64 = 0x%I64X, swapped = 0x%I64X\n", value64,
@ -130,7 +122,6 @@ TestEndian(SDL_bool verbose)
}
++error;
}
#endif
return (error ? 1 : 0);
}