Fixed const correctness issue with C++, and fixed building SDL_memcpy4 with 32-bit gcc.
This commit is contained in:
parent
6ea7a3490d
commit
77815e31db
1 changed files with 3 additions and 7 deletions
|
@ -414,19 +414,15 @@ SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len)
|
||||||
|
|
||||||
SDL_FORCE_INLINE void *SDL_memcpy4(void *dst, const void *src, size_t dwords)
|
SDL_FORCE_INLINE void *SDL_memcpy4(void *dst, const void *src, size_t dwords)
|
||||||
{
|
{
|
||||||
#if defined(__MACOSX__)
|
#if defined(__GNUC__) && defined(i386)
|
||||||
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
|
|
||||||
return memcpy(dst, src, dwords * 4);
|
|
||||||
#elif defined(__GNUC__) && defined(i386)
|
|
||||||
/* !!! FIXME: does this _really_ beat memcpy() on any modern platform? */
|
/* !!! FIXME: does this _really_ beat memcpy() on any modern platform? */
|
||||||
/* !!! FIXME: shouldn't we just force the inputs to ecx/edi/esi instead of this tapdance with outputs? */
|
/* !!! FIXME: shouldn't we just force the inputs to ecx/edi/esi instead of this tapdance with outputs? */
|
||||||
/* !!! FIXME: amd64? */
|
|
||||||
int ecx, edi, esi;
|
int ecx, edi, esi;
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"cld \n\t"
|
"cld \n\t"
|
||||||
"rep ; movsl \n\t"
|
"rep ; movsl \n\t"
|
||||||
: "=&c" (ecx), "=&D" (edi), "=&S" (esi)
|
: "=&c" (ecx), "=&D" (edi), "=&S" (esi)
|
||||||
: "0" (SDL_static_cast(unsigned, len)), "1" (dst), "2" (src)
|
: "0" (SDL_static_cast(unsigned, dwords)), "1" (dst), "2" (src)
|
||||||
: "memory"
|
: "memory"
|
||||||
);
|
);
|
||||||
return dst;
|
return dst;
|
||||||
|
@ -512,7 +508,7 @@ SDL_FORCE_INLINE char *SDL_strlwr_inline(char *str) { return _strlwr(str); }
|
||||||
|
|
||||||
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
|
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
|
||||||
#ifdef HAVE_STRCHR
|
#ifdef HAVE_STRCHR
|
||||||
SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return strchr(str, c); }
|
SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return (char*)strchr(str, c); }
|
||||||
#define SDL_strchr SDL_strchr_inline
|
#define SDL_strchr SDL_strchr_inline
|
||||||
#elif defined(HAVE_INDEX) /* !!! FIXME: is there anywhere that has this but not strchr? */
|
#elif defined(HAVE_INDEX) /* !!! FIXME: is there anywhere that has this but not strchr? */
|
||||||
SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return index(str, c); }
|
SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return index(str, c); }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue