comparison src/video/SDL_blit.h @ 91:e85e03f195b4

From: "Markus F.X.J. Oberhumer" Subject: SDL CVS patches below you will find some small patches against the current SDL CVS. It adresses these things: 1) Use "&" instead of "%" in some cases. For negative signed integers (x % 8) is not always (x & 7), and the compiler can produce slightly faster code when using "&" here. 2) Some const issues.
author Sam Lantinga <slouken@lokigames.com>
date Sat, 07 Jul 2001 20:20:17 +0000
parents 74212992fb08
children 2dc7252dc53e
comparison
equal deleted inserted replaced
90:ee1f71c10889 91:e85e03f195b4
382 #ifdef USE_DUFFS_LOOP 382 #ifdef USE_DUFFS_LOOP
383 383
384 /* 8-times unrolled loop */ 384 /* 8-times unrolled loop */
385 #define DUFFS_LOOP8(pixel_copy_increment, width) \ 385 #define DUFFS_LOOP8(pixel_copy_increment, width) \
386 { int n = (width+7)/8; \ 386 { int n = (width+7)/8; \
387 switch (width % 8) { \ 387 switch (width & 7) { \
388 case 0: do { pixel_copy_increment; \ 388 case 0: do { pixel_copy_increment; \
389 case 7: pixel_copy_increment; \ 389 case 7: pixel_copy_increment; \
390 case 6: pixel_copy_increment; \ 390 case 6: pixel_copy_increment; \
391 case 5: pixel_copy_increment; \ 391 case 5: pixel_copy_increment; \
392 case 4: pixel_copy_increment; \ 392 case 4: pixel_copy_increment; \
398 } 398 }
399 399
400 /* 4-times unrolled loop */ 400 /* 4-times unrolled loop */
401 #define DUFFS_LOOP4(pixel_copy_increment, width) \ 401 #define DUFFS_LOOP4(pixel_copy_increment, width) \
402 { int n = (width+3)/4; \ 402 { int n = (width+3)/4; \
403 switch (width % 4) { \ 403 switch (width & 3) { \
404 case 0: do { pixel_copy_increment; \ 404 case 0: do { pixel_copy_increment; \
405 case 3: pixel_copy_increment; \ 405 case 3: pixel_copy_increment; \
406 case 2: pixel_copy_increment; \ 406 case 2: pixel_copy_increment; \
407 case 1: pixel_copy_increment; \ 407 case 1: pixel_copy_increment; \
408 } while ( --n > 0 ); \ 408 } while ( --n > 0 ); \