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

Commit

Permalink
Gained 5 FPS in testsprite because Mac OS X memset is highly optimized
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Aug 12, 2007
1 parent e3bb2ab commit 3eff1b5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/video/SDL_surface.c
Expand Up @@ -568,14 +568,17 @@ SDL_FillRect(SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color)
dstrect->x * dst->format->BytesPerPixel;
if (dst->format->palette || (color == 0)) {
x = dstrect->w * dst->format->BytesPerPixel;
#ifndef __MACOSX__ /* memset() is optimized on Mac OS X */
if (!color && !((uintptr_t) row & 3) && !(x & 3)
&& !(dst->pitch & 3)) {
int n = x >> 2;
for (y = dstrect->h; y; --y) {
SDL_memset4(row, 0, n);
row += dst->pitch;
}
} else {
} else
#endif /* !__MACOSX__ */
{
for (y = dstrect->h; y; y--) {
SDL_memset(row, color, x);
row += dst->pitch;
Expand Down

0 comments on commit 3eff1b5

Please sign in to comment.