optimize main loop in SDL_UnlockSurface to avoid a branch