Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
SDL_memcpyMMX(): Fixed handling of overflow bytes.
Browse files Browse the repository at this point in the history
Thanks to Mason Wheeler for the fix!
  • Loading branch information
icculus committed Oct 29, 2011
1 parent 5bc4851 commit cde3a8c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/video/SDL_blit_copy.c
Expand Up @@ -59,6 +59,7 @@ SDL_memcpySSE(Uint8 * dst, const Uint8 * src, int len)
static __inline__ void
SDL_memcpyMMX(Uint8 * dst, const Uint8 * src, int len)
{
const int remain = (len & 63);
int i;

__m64* d64 = (__m64*)dst;
Expand All @@ -78,8 +79,11 @@ SDL_memcpyMMX(Uint8 * dst, const Uint8 * src, int len)
s64 += 8;
}

if (len & 63)
SDL_memcpy(dst, src, len & 63);
if (remain)
{
const int skip = len - remain;
SDL_memcpy(dst + skip, src + skip, remain);
}
}
#endif /* __MMX__ */

Expand Down

0 comments on commit cde3a8c

Please sign in to comment.