Commit 8bc3ad08 authored by Ryan C. Gordon's avatar Ryan C. Gordon

Patched to compile on BeOS and old, old GCC releases.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402257
parent a258df05
...@@ -56,7 +56,7 @@ extern "C" { ...@@ -56,7 +56,7 @@ extern "C" {
header should only be included in files that actually use them. header should only be included in files that actually use them.
*/ */
#if defined(__GNUC__) && defined(__i386__) && \ #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) static __inline__ Uint16 SDL_Swap16(Uint16 x)
{ {
__asm__("xchgb %b0,%h0" : "=q" (x) : "0" (x)); __asm__("xchgb %b0,%h0" : "=q" (x) : "0" (x));
...@@ -88,7 +88,8 @@ static __inline__ Uint16 SDL_Swap16(Uint16 x) { ...@@ -88,7 +88,8 @@ static __inline__ Uint16 SDL_Swap16(Uint16 x) {
} }
#endif #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) static __inline__ Uint32 SDL_Swap32(Uint32 x)
{ {
__asm__("bswap %0" : "=r" (x) : "0" (x)); __asm__("bswap %0" : "=r" (x) : "0" (x));
...@@ -123,7 +124,8 @@ static __inline__ Uint32 SDL_Swap32(Uint32 x) { ...@@ -123,7 +124,8 @@ static __inline__ Uint32 SDL_Swap32(Uint32 x) {
#endif #endif
#ifdef SDL_HAS_64BIT_TYPE #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) static __inline__ Uint64 SDL_Swap64(Uint64 x)
{ {
union { union {
......
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && SDL_ASSEMBLY_ROUTINES #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && SDL_ASSEMBLY_ROUTINES
#define MMX_ASMBLIT #define MMX_ASMBLIT
#if (__GNUC__ > 2) /* SSE instructions aren't in GCC 2. */
#define SSE_ASMBLIT
#endif
#endif #endif
#if defined(MMX_ASMBLIT) #if defined(MMX_ASMBLIT)
...@@ -122,6 +125,7 @@ static __inline__ void SDL_memcpyMMX(Uint8 *to, const Uint8 *from, int len) ...@@ -122,6 +125,7 @@ static __inline__ void SDL_memcpyMMX(Uint8 *to, const Uint8 *from, int len)
SDL_memcpy(to, from, len&7); SDL_memcpy(to, from, len&7);
} }
#ifdef SSE_ASMBLIT
static __inline__ void SDL_memcpySSE(Uint8 *to, const Uint8 *from, int len) static __inline__ void SDL_memcpySSE(Uint8 *to, const Uint8 *from, int len)
{ {
int i; int i;
...@@ -146,6 +150,7 @@ static __inline__ void SDL_memcpySSE(Uint8 *to, const Uint8 *from, int len) ...@@ -146,6 +150,7 @@ static __inline__ void SDL_memcpySSE(Uint8 *to, const Uint8 *from, int len)
SDL_memcpy(to, from, len&7); SDL_memcpy(to, from, len&7);
} }
#endif #endif
#endif
static void SDL_BlitCopy(SDL_BlitInfo *info) static void SDL_BlitCopy(SDL_BlitInfo *info)
{ {
...@@ -159,7 +164,8 @@ static void SDL_BlitCopy(SDL_BlitInfo *info) ...@@ -159,7 +164,8 @@ static void SDL_BlitCopy(SDL_BlitInfo *info)
dst = info->d_pixels; dst = info->d_pixels;
srcskip = w+info->s_skip; srcskip = w+info->s_skip;
dstskip = w+info->d_skip; dstskip = w+info->d_skip;
#ifdef MMX_ASMBLIT
#ifdef SSE_ASMBLIT
if(SDL_HasSSE()) if(SDL_HasSSE())
{ {
while ( h-- ) { while ( h-- ) {
...@@ -172,6 +178,8 @@ static void SDL_BlitCopy(SDL_BlitInfo *info) ...@@ -172,6 +178,8 @@ static void SDL_BlitCopy(SDL_BlitInfo *info)
::); ::);
} }
else else
#endif
#ifdef MMX_ASMBLIT
if(SDL_HasMMX()) if(SDL_HasMMX())
{ {
while ( h-- ) { while ( h-- ) {
......
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