Fixed const correctness issue with C++, and fixed building SDL_memcpy4 with 32-bit gcc.
authorSam Lantinga <slouken@libsdl.org>
Fri, 15 Mar 2013 11:56:28 -0700
changeset 7006ffcf28627e1c
parent 7005 6c69ad0b184e
child 7007 2381f4d531d1
Fixed const correctness issue with C++, and fixed building SDL_memcpy4 with 32-bit gcc.
include/SDL_stdinc.h
     1.1 --- a/include/SDL_stdinc.h	Thu Mar 14 23:10:51 2013 -0700
     1.2 +++ b/include/SDL_stdinc.h	Fri Mar 15 11:56:28 2013 -0700
     1.3 @@ -414,19 +414,15 @@
     1.4  
     1.5  SDL_FORCE_INLINE void *SDL_memcpy4(void *dst, const void *src, size_t dwords)
     1.6  {
     1.7 -#if defined(__MACOSX__)
     1.8 -    /* We can count on memcpy existing on Mac OS X and being well-tuned. */
     1.9 -    return memcpy(dst, src, dwords * 4);
    1.10 -#elif defined(__GNUC__) && defined(i386)
    1.11 +#if defined(__GNUC__) && defined(i386)
    1.12      /* !!! FIXME: does this _really_ beat memcpy() on any modern platform? */
    1.13      /* !!! FIXME: shouldn't we just force the inputs to ecx/edi/esi instead of this tapdance with outputs? */
    1.14 -    /* !!! FIXME: amd64? */
    1.15      int ecx, edi, esi;
    1.16      __asm__ __volatile__ (
    1.17          "cld \n\t"
    1.18          "rep ; movsl \n\t"
    1.19          : "=&c" (ecx), "=&D" (edi), "=&S" (esi)
    1.20 -        : "0" (SDL_static_cast(unsigned, len)), "1" (dst), "2" (src)
    1.21 +        : "0" (SDL_static_cast(unsigned, dwords)), "1" (dst), "2" (src)
    1.22          : "memory"
    1.23      );
    1.24      return dst;
    1.25 @@ -512,7 +508,7 @@
    1.26  
    1.27  extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
    1.28  #ifdef HAVE_STRCHR
    1.29 -SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return strchr(str, c); }
    1.30 +SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return (char*)strchr(str, c); }
    1.31  #define SDL_strchr SDL_strchr_inline
    1.32  #elif defined(HAVE_INDEX)  /* !!! FIXME: is there anywhere that has this but not strchr? */
    1.33  SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return index(str, c); }