oslibs: updates to SDL-1.2 headers from mainstream.

This commit is contained in:
Ozkan Sezer 2021-11-25 17:21:20 +03:00
parent 6cf4bbc198
commit 3f831f67e0
6 changed files with 40 additions and 22 deletions

View File

@ -131,6 +131,12 @@ typedef unsigned int uintptr_t;
#define HAVE_STDDEF_H 1
#endif
/* Windows CE can support only _strdup() */
#if defined(_WIN32_WCE) && defined(HAVE_STRDUP)
#undef strdup
#define strdup _strdup
#endif
/* Enable various audio drivers */
#ifndef _WIN32_WCE
#define SDL_AUDIO_DRIVER_DSOUND 1

View File

@ -55,7 +55,7 @@
#else
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#endif
#endif /* __linux __ */
#endif /* __linux__ */
#endif /* !SDL_BYTEORDER */
@ -97,8 +97,7 @@ static __inline__ Uint16 SDL_Swap16(Uint16 x)
#elif defined(__GNUC__) && defined(__aarch64__)
static __inline__ Uint16 SDL_Swap16(Uint16 x)
{
__asm__("rev16 %w1, %w0" : "=r"(x) : "r"(x));
return x;
return __builtin_bswap16(x);
}
#elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__))
static __inline__ Uint16 SDL_Swap16(Uint16 x)
@ -107,7 +106,7 @@ static __inline__ Uint16 SDL_Swap16(Uint16 x)
return x;
}
#elif defined(__WATCOMC__) && defined(__386__)
extern _inline Uint16 SDL_Swap16(Uint16);
extern __inline Uint16 SDL_Swap16(Uint16);
#pragma aux SDL_Swap16 = \
"xchg al, ah" \
parm [ax] \
@ -144,8 +143,7 @@ static __inline__ Uint32 SDL_Swap32(Uint32 x)
#elif defined(__GNUC__) && defined(__aarch64__)
static __inline__ Uint32 SDL_Swap32(Uint32 x)
{
__asm__("rev %w1, %w0": "=r"(x):"r"(x));
return x;
return __builtin_bswap32(x);
}
#elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__))
static __inline__ Uint32 SDL_Swap32(Uint32 x)
@ -154,7 +152,7 @@ static __inline__ Uint32 SDL_Swap32(Uint32 x)
return x;
}
#elif defined(__WATCOMC__) && defined(__386__)
extern _inline Uint32 SDL_Swap32(Uint32);
extern __inline Uint32 SDL_Swap32(Uint32);
#pragma aux SDL_Swap32 = \
"bswap eax" \
parm [eax] \
@ -165,7 +163,7 @@ static __inline__ Uint32 SDL_Swap32(Uint32 x) {
}
#endif
#ifdef SDL_HAS_64BIT_TYPE
#ifdef SDL_HAS_64BIT_TYPE /**/
#if defined(__GNUC__) && defined(__i386__) && \
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
static __inline__ Uint64 SDL_Swap64(Uint64 x)
@ -180,6 +178,11 @@ static __inline__ Uint64 SDL_Swap64(Uint64 x)
: "0" (v.s.a), "1" (v.s.b));
return v.u;
}
#elif defined(__GNUC__) && defined(__aarch64__)
static __inline__ Uint64 SDL_Swap64(Uint64 x)
{
return __builtin_bswap64(x);
}
#elif defined(__GNUC__) && defined(__x86_64__)
static __inline__ Uint64 SDL_Swap64(Uint64 x)
{
@ -187,7 +190,7 @@ static __inline__ Uint64 SDL_Swap64(Uint64 x)
return x;
}
#elif defined(__WATCOMC__) && defined(__386__)
extern _inline Uint64 SDL_Swap64(Uint64);
extern __inline Uint64 SDL_Swap64(Uint64);
#pragma aux SDL_Swap64 = \
"bswap eax" \
"bswap edx" \
@ -209,7 +212,7 @@ static __inline__ Uint64 SDL_Swap64(Uint64 x)
return (x);
}
#endif
#else
#else /* SDL_HAS_64BIT_TYPE */
/* 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.

View File

@ -532,7 +532,7 @@ extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp);
#ifdef HAVE_ATOI
#define SDL_atoi atoi
#else
#define SDL_atoi(X) SDL_strtol(X, NULL, 0)
#define SDL_atoi(X) SDL_strtol(X, NULL, 10)
#endif
#ifdef HAVE_ATOF

View File

@ -131,6 +131,12 @@ typedef unsigned int uintptr_t;
#define HAVE_STDDEF_H 1
#endif
/* Windows CE can support only _strdup() */
#if defined(_WIN32_WCE) && defined(HAVE_STRDUP)
#undef strdup
#define strdup _strdup
#endif
/* Enable various audio drivers */
#ifndef _WIN32_WCE
#define SDL_AUDIO_DRIVER_DSOUND 1

View File

@ -55,7 +55,7 @@
#else
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#endif
#endif /* __linux __ */
#endif /* __linux__ */
#endif /* !SDL_BYTEORDER */
@ -97,8 +97,7 @@ static __inline__ Uint16 SDL_Swap16(Uint16 x)
#elif defined(__GNUC__) && defined(__aarch64__)
static __inline__ Uint16 SDL_Swap16(Uint16 x)
{
__asm__("rev16 %w1, %w0" : "=r"(x) : "r"(x));
return x;
return __builtin_bswap16(x);
}
#elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__))
static __inline__ Uint16 SDL_Swap16(Uint16 x)
@ -107,7 +106,7 @@ static __inline__ Uint16 SDL_Swap16(Uint16 x)
return x;
}
#elif defined(__WATCOMC__) && defined(__386__)
extern _inline Uint16 SDL_Swap16(Uint16);
extern __inline Uint16 SDL_Swap16(Uint16);
#pragma aux SDL_Swap16 = \
"xchg al, ah" \
parm [ax] \
@ -144,8 +143,7 @@ static __inline__ Uint32 SDL_Swap32(Uint32 x)
#elif defined(__GNUC__) && defined(__aarch64__)
static __inline__ Uint32 SDL_Swap32(Uint32 x)
{
__asm__("rev %w1, %w0": "=r"(x):"r"(x));
return x;
return __builtin_bswap32(x);
}
#elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__))
static __inline__ Uint32 SDL_Swap32(Uint32 x)
@ -154,7 +152,7 @@ static __inline__ Uint32 SDL_Swap32(Uint32 x)
return x;
}
#elif defined(__WATCOMC__) && defined(__386__)
extern _inline Uint32 SDL_Swap32(Uint32);
extern __inline Uint32 SDL_Swap32(Uint32);
#pragma aux SDL_Swap32 = \
"bswap eax" \
parm [eax] \
@ -165,7 +163,7 @@ static __inline__ Uint32 SDL_Swap32(Uint32 x) {
}
#endif
#ifdef SDL_HAS_64BIT_TYPE
#ifdef SDL_HAS_64BIT_TYPE /**/
#if defined(__GNUC__) && defined(__i386__) && \
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
static __inline__ Uint64 SDL_Swap64(Uint64 x)
@ -180,6 +178,11 @@ static __inline__ Uint64 SDL_Swap64(Uint64 x)
: "0" (v.s.a), "1" (v.s.b));
return v.u;
}
#elif defined(__GNUC__) && defined(__aarch64__)
static __inline__ Uint64 SDL_Swap64(Uint64 x)
{
return __builtin_bswap64(x);
}
#elif defined(__GNUC__) && defined(__x86_64__)
static __inline__ Uint64 SDL_Swap64(Uint64 x)
{
@ -187,7 +190,7 @@ static __inline__ Uint64 SDL_Swap64(Uint64 x)
return x;
}
#elif defined(__WATCOMC__) && defined(__386__)
extern _inline Uint64 SDL_Swap64(Uint64);
extern __inline Uint64 SDL_Swap64(Uint64);
#pragma aux SDL_Swap64 = \
"bswap eax" \
"bswap edx" \
@ -209,7 +212,7 @@ static __inline__ Uint64 SDL_Swap64(Uint64 x)
return (x);
}
#endif
#else
#else /* SDL_HAS_64BIT_TYPE */
/* 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.

View File

@ -532,7 +532,7 @@ extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp);
#ifdef HAVE_ATOI
#define SDL_atoi atoi
#else
#define SDL_atoi(X) SDL_strtol(X, NULL, 0)
#define SDL_atoi(X) SDL_strtol(X, NULL, 10)
#endif
#ifdef HAVE_ATOF