src/video/SDL_blit.h
changeset 689 5bb080d35049
parent 553 417f8709e648
child 769 b8d311d90021
     1.1 --- a/src/video/SDL_blit.h	Tue Aug 12 15:17:20 2003 +0000
     1.2 +++ b/src/video/SDL_blit.h	Fri Aug 22 05:51:19 2003 +0000
     1.3 @@ -410,6 +410,47 @@
     1.4  	}								\
     1.5  }
     1.6  
     1.7 +/* 2 - times unrolled loop */
     1.8 +#define DUFFS_LOOP_DOUBLE2(pixel_copy_increment,			\
     1.9 +				double_pixel_copy_increment, width)	\
    1.10 +{ int n, w = width;							\
    1.11 +	if( w & 1 ) {							\
    1.12 +	    pixel_copy_increment;					\
    1.13 +	    w--;							\
    1.14 +	}								\
    1.15 +	if ( w > 0 )	{						\
    1.16 +	    n = ( w + 2) / 4;						\
    1.17 +	    switch( w & 2 ) {						\
    1.18 +	    case 0: do {	double_pixel_copy_increment;		\
    1.19 +	    case 2:		double_pixel_copy_increment;		\
    1.20 +		    } while ( --n > 0 );					\
    1.21 +	    }								\
    1.22 +	}								\
    1.23 +}
    1.24 +
    1.25 +/* 2 - times unrolled loop 4 pixels */
    1.26 +#define DUFFS_LOOP_QUATRO2(pixel_copy_increment,			\
    1.27 +				double_pixel_copy_increment,		\
    1.28 +				quatro_pixel_copy_increment, width)	\
    1.29 +{ int n, w = width;								\
    1.30 +        if(w & 1) {							\
    1.31 +	  pixel_copy_increment;						\
    1.32 +	  w--;								\
    1.33 +	}								\
    1.34 +	if(w & 2) {							\
    1.35 +	  double_pixel_copy_increment;					\
    1.36 +	  w -= 2;							\
    1.37 +	}								\
    1.38 +	if ( w > 0 ) {							\
    1.39 +	    n = ( w + 7 ) / 8;						\
    1.40 +	    switch( w & 4 ) {						\
    1.41 +	    case 0: do {	quatro_pixel_copy_increment;		\
    1.42 +	    case 4:		quatro_pixel_copy_increment;		\
    1.43 +		    } while ( --n > 0 );					\
    1.44 +	    }								\
    1.45 +	}								\
    1.46 +}
    1.47 +
    1.48  /* Use the 8-times version of the loop by default */
    1.49  #define DUFFS_LOOP(pixel_copy_increment, width)				\
    1.50  	DUFFS_LOOP8(pixel_copy_increment, width)
    1.51 @@ -417,6 +458,39 @@
    1.52  #else
    1.53  
    1.54  /* Don't use Duff's device to unroll loops */
    1.55 +#define DUFFS_LOOP_DOUBLE2(pixel_copy_increment,			\
    1.56 +			 double_pixel_copy_increment, width)		\
    1.57 +{ int n = width;								\
    1.58 +    if( n & 1 ) {							\
    1.59 +	pixel_copy_increment;						\
    1.60 +	n--;								\
    1.61 +    }									\
    1.62 +    n=n>>1;								\
    1.63 +    for(; n > 0; --n) {   						\
    1.64 +	double_pixel_copy_increment;					\
    1.65 +    }									\
    1.66 +}
    1.67 +
    1.68 +/* Don't use Duff's device to unroll loops */
    1.69 +#define DUFFS_LOOP_QUATRO2(pixel_copy_increment,			\
    1.70 +				double_pixel_copy_increment,		\
    1.71 +				quatro_pixel_copy_increment, width)	\
    1.72 +{ int n = width;								\
    1.73 +        if(n & 1) {							\
    1.74 +	  pixel_copy_increment;						\
    1.75 +	  n--;								\
    1.76 +	}								\
    1.77 +	if(n & 2) {							\
    1.78 +	  double_pixel_copy_increment;					\
    1.79 +	  n -= 2;							\
    1.80 +	}								\
    1.81 +	n=n>>2;								\
    1.82 +	for(; n > 0; --n) {   						\
    1.83 +	  quatro_pixel_copy_increment;					\
    1.84 +        }								\
    1.85 +}
    1.86 +
    1.87 +/* Don't use Duff's device to unroll loops */
    1.88  #define DUFFS_LOOP(pixel_copy_increment, width)				\
    1.89  { int n;								\
    1.90  	for ( n=width; n > 0; --n ) {					\