Commit cd6cd131 authored by Ryan C. Gordon's avatar Ryan C. Gordon

SDL_memcpyMMX(): Fixed handling of overflow bytes.

Thanks to Mason Wheeler for the fix!
parent e66bcd9e
...@@ -59,6 +59,7 @@ SDL_memcpySSE(Uint8 * dst, const Uint8 * src, int len) ...@@ -59,6 +59,7 @@ SDL_memcpySSE(Uint8 * dst, const Uint8 * src, int len)
static __inline__ void static __inline__ void
SDL_memcpyMMX(Uint8 * dst, const Uint8 * src, int len) SDL_memcpyMMX(Uint8 * dst, const Uint8 * src, int len)
{ {
const int remain = (len & 63);
int i; int i;
__m64* d64 = (__m64*)dst; __m64* d64 = (__m64*)dst;
...@@ -78,8 +79,11 @@ SDL_memcpyMMX(Uint8 * dst, const Uint8 * src, int len) ...@@ -78,8 +79,11 @@ SDL_memcpyMMX(Uint8 * dst, const Uint8 * src, int len)
s64 += 8; s64 += 8;
} }
if (len & 63) if (remain)
SDL_memcpy(dst, src, len & 63); {
const int skip = len - remain;
SDL_memcpy(dst + skip, src + skip, remain);
}
} }
#endif /* __MMX__ */ #endif /* __MMX__ */
......
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