8000 SDL/src/video/SDL_blit.h at SDL2 · zaucy/SDL · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
589 lines (553 loc) · 26 KB

SDL_blit.h

File metadata and controls

589 lines (553 loc) · 26 KB
pixel_copy_increment; \
SDL_FALLTHROUGH; \
case 3: \
pixel_copy_increment; \
SDL_FALLTHROUGH; \
case 2: \
pixel_copy_increment; \
SDL_FALLTHROUGH; \
case 1: \
pixel_copy_increment; \
} while (--n > 0); \
} \
}
/* 4-times unrolled loop */
#define DUFFS_LOOP4(pixel_copy_increment, width) \
{ \
int n = (width + 3) / 4; \
switch (width & 3) { \
case 0: \
do { \
pixel_copy_increment; \
SDL_FALLTHROUGH; \
case 3: \
pixel_copy_increment; \
SDL_FALLTHROUGH; \
case 2: \
pixel_copy_increment; \
SDL_FALLTHROUGH; \
case 1: \
pixel_copy_increment; \
} while (--n > 0); \
} \
}
/* Use the 8-times version of the loop by default */
#define DUFFS_LOOP(pixel_copy_increment, width) \
DUFFS_LOOP8(pixel_copy_increment, width)
/* Special version of Duff's device for even more optimization */
#define DUFFS_LOOP_124(pixel_copy_increment1, \
pixel_copy_increment2, \
pixel_copy_increment4, width) \
{ \
int n = width; \
if (n & 1) { \
pixel_copy_increment1; \
n -= 1; \
} \
if (n & 2) { \
pixel_copy_increment2; \
n -= 2; \
} \
if (n & 4) { \
pixel_copy_increment4; \
n -= 4; \
} \
if (n) { \
n /= 8; \
do { \
pixel_copy_increment4; \
pixel_copy_increment4; \
} while (--n > 0); \
} \
}
#else
/* Don't use Duff's device to unroll loops */
#define DUFFS_LOOP(pixel_copy_increment, width) \
{ \
int n; \
for (n = width; n > 0; --n) { \
pixel_copy_increment; \
} \
}
#define DUFFS_LOOP8(pixel_copy_increment, width) \
DUFFS_LOOP(pixel_copy_increment, width)
#define DUFFS_LOOP4(pixel_copy_increment, width) \
DUFFS_LOOP(pixel_copy_increment, width)
#define DUFFS_LOOP_124(pixel_copy_increment1, \
pixel_copy_increment2, \
pixel_copy_increment4, width) \
DUFFS_LOOP(pixel_copy_increment1, width)
#endif /* USE_DUFFS_LOOP */
/* Prevent Visual C++ 6.0 from printing out stupid warnings */
#if defined(_MSC_VER) && (_MSC_VER >= 600)
#pragma warning(disable : 4550)
#endif
#endif /* SDL_blit_h_ */
/* vi: set ts=4 sw=4 expandtab: */
0