Skip to content
Permalink
Browse files

Use system memset/memcpy on Mac OS X, since Apple hand-tunes these fo…

…r each

 processor they ship (and thus, it's likely to beat our code on PowerPC and
 Intel and whatever variants or new archs show up later).
  • Loading branch information
icculus committed Jun 3, 2007
1 parent 9eb4022 commit 2864dafcd2006826361ddf9e3b446dd65fd99025
Showing with 12 additions and 3 deletions.
  1. +12 −3 include/SDL_stdinc.h
@@ -234,7 +234,10 @@ extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len);
#endif

#if defined(__GNUC__) && defined(i386)
/* We can count on memset existing on Mac OS X and being well-tuned. */
#if defined(__MACH__) && defined(__APPLE__)
#define SDL_memset4(dst, val, len) memset(dst, val, (len)*4)
#elif defined(__GNUC__) && defined(i386)
#define SDL_memset4(dst, val, len) \
do { \
int u0, u1, u2; \
@@ -263,7 +266,10 @@ do { \
} while(0)
#endif

#if defined(__GNUC__) && defined(i386)
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
#if defined(__MACH__) && defined(__APPLE__)
#define SDL_memcpy(dst, src, len) memcpy(dst, src, len)
#elif defined(__GNUC__) && defined(i386)
#define SDL_memcpy(dst, src, len) \
do { \
int u0, u1, u2; \
@@ -292,7 +298,10 @@ extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len
#endif
#endif

#if defined(__GNUC__) && defined(i386)
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
#if defined(__MACH__) && defined(__APPLE__)
#define SDL_memcpy4(dst, src, len) memcpy(dst, src, (len)*4)
#elif defined(__GNUC__) && defined(i386)
#define SDL_memcpy4(dst, src, len) \
do { \
int ecx, edi, esi; \

0 comments on commit 2864daf

Please sign in to comment.