Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
This commit is contained in:
parent
b2d7f92773
commit
98053e8a85
1 changed files with 25 additions and 1 deletions
|
@ -257,9 +257,33 @@ extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len);
|
||||||
/* Note that the semantics are different from memset() in that this is a 32-bit assignment */
|
/* Note that the semantics are different from memset() in that this is a 32-bit assignment */
|
||||||
SDL_FORCE_INLINE void SDL_memset4(void *dst, int val, size_t dwords)
|
SDL_FORCE_INLINE void SDL_memset4(void *dst, int val, size_t dwords)
|
||||||
{
|
{
|
||||||
SDL_memset(dst, val, dwords * 4);
|
#if defined(__GNUC__) && defined(i386)
|
||||||
|
int u0, u1, u2;
|
||||||
|
__asm__ __volatile__ (
|
||||||
|
"cld \n\t"
|
||||||
|
"rep ; stosl \n\t"
|
||||||
|
: "=&D" (u0), "=&a" (u1), "=&c" (u2)
|
||||||
|
: "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords))
|
||||||
|
: "memory"
|
||||||
|
);
|
||||||
|
#else
|
||||||
|
size_t _n = (dwords + 3) / 4;
|
||||||
|
Uint32 *_p = SDL_static_cast(Uint32 *, dst);
|
||||||
|
Uint32 _val = (val);
|
||||||
|
if (dwords == 0)
|
||||||
|
return;
|
||||||
|
switch (dwords % 4)
|
||||||
|
{
|
||||||
|
case 0: do { *_p++ = _val;
|
||||||
|
case 3: *_p++ = _val;
|
||||||
|
case 2: *_p++ = _val;
|
||||||
|
case 1: *_p++ = _val;
|
||||||
|
} while ( --_n );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len);
|
extern DECLSPEC void *SDLCALL SDL_memcpy(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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue