Enable altivec blitters on PowerPC Linux, and some fixes for recent
authorRyan C. Gordon <icculus@icculus.org>
Thu, 20 Oct 2005 06:55:26 +0000
changeset 11622651158f59b8
parent 1161 05d4b93b911e
child 1163 96ef83467667
Enable altivec blitters on PowerPC Linux, and some fixes for recent
GCCs versions.
configure.in
src/video/SDL_blit.h
src/video/SDL_blit_A.c
src/video/SDL_blit_N.c
     1.1 --- a/configure.in	Thu Oct 20 06:53:56 2005 +0000
     1.2 +++ b/configure.in	Thu Oct 20 06:55:26 2005 +0000
     1.3 @@ -1910,11 +1910,16 @@
     1.4  dnl Check for altivec instruction support using gas syntax
     1.5  CheckAltivec()
     1.6  {
     1.7 -    AC_MSG_CHECKING(for GCC Altivec instruction support)
     1.8 +    dnl FIXME: Theoretically, you might not have altivec.h, we should check
     1.9 +    dnl FIXME:  that seperately, but I think all major platforms have it
    1.10 +    dnl FIXME:  at the moment...  --ryan.
    1.11 +
    1.12 +    save_CFLAGS="${CFLAGS}"
    1.13      have_gcc_altivec=no
    1.14 -    save_CFLAGS="${CFLAGS}"
    1.15 -    CFLAGS="${CFLAGS} -DGCC_ALTIVEC -DUSE_ALTIVEC_BLITTERS -faltivec"
    1.16 +    AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
    1.17 +    CFLAGS="${save_CFLAGS} -DGCC_ALTIVEC -DUSE_ALTIVEC_BLITTERS -maltivec"
    1.18      AC_TRY_COMPILE([
    1.19 +    #include <altivec.h>
    1.20      vector unsigned int vzero() {
    1.21          return vec_splat_u32(0);
    1.22      }
    1.23 @@ -1922,10 +1927,26 @@
    1.24      ],[
    1.25      have_gcc_altivec=yes
    1.26      ])
    1.27 +    AC_MSG_RESULT($have_gcc_altivec)
    1.28 +
    1.29 +    if test x$have_gcc_altivec = xno; then
    1.30 +        AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
    1.31 +        CFLAGS="${CFLAGS} -DGCC_ALTIVEC -DUSE_ALTIVEC_BLITTERS -faltivec"
    1.32 +        AC_TRY_COMPILE([
    1.33 +        #include <altivec.h>
    1.34 +        vector unsigned int vzero() {
    1.35 +            return vec_splat_u32(0);
    1.36 +        }
    1.37 +        ],[
    1.38 +        ],[
    1.39 +        have_gcc_altivec=yes
    1.40 +        ])
    1.41 +        AC_MSG_RESULT($have_gcc_altivec)
    1.42 +    fi
    1.43 +
    1.44      if test x$have_gcc_altivec = xno; then
    1.45          CFLAGS="${save_CFLAGS}"
    1.46      fi
    1.47 -    AC_MSG_RESULT($have_gcc_altivec)
    1.48  }
    1.49  
    1.50  dnl Check for a valid linux/version.h
     2.1 --- a/src/video/SDL_blit.h	Thu Oct 20 06:53:56 2005 +0000
     2.2 +++ b/src/video/SDL_blit.h	Thu Oct 20 06:55:26 2005 +0000
     2.3 @@ -90,112 +90,112 @@
     2.4  
     2.5  /* Load pixel of the specified format from a buffer and get its R-G-B values */
     2.6  /* FIXME: rescale values to 0..255 here? */
     2.7 -#define RGB_FROM_PIXEL(pixel, fmt, r, g, b)				\
     2.8 +#define RGB_FROM_PIXEL(Pixel, fmt, r, g, b)				\
     2.9  {									\
    2.10 -	r = (((pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss); 		\
    2.11 -	g = (((pixel&fmt->Gmask)>>fmt->Gshift)<<fmt->Gloss); 		\
    2.12 -	b = (((pixel&fmt->Bmask)>>fmt->Bshift)<<fmt->Bloss); 		\
    2.13 +	r = (((Pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss); 		\
    2.14 +	g = (((Pixel&fmt->Gmask)>>fmt->Gshift)<<fmt->Gloss); 		\
    2.15 +	b = (((Pixel&fmt->Bmask)>>fmt->Bshift)<<fmt->Bloss); 		\
    2.16  }
    2.17 -#define RGB_FROM_RGB565(pixel, r, g, b)					\
    2.18 +#define RGB_FROM_RGB565(Pixel, r, g, b)					\
    2.19  {									\
    2.20 -	r = (((pixel&0xF800)>>11)<<3);		 			\
    2.21 -	g = (((pixel&0x07E0)>>5)<<2); 					\
    2.22 -	b = ((pixel&0x001F)<<3); 					\
    2.23 +	r = (((Pixel&0xF800)>>11)<<3);		 			\
    2.24 +	g = (((Pixel&0x07E0)>>5)<<2); 					\
    2.25 +	b = ((Pixel&0x001F)<<3); 					\
    2.26  }
    2.27 -#define RGB_FROM_RGB555(pixel, r, g, b)					\
    2.28 +#define RGB_FROM_RGB555(Pixel, r, g, b)					\
    2.29  {									\
    2.30 -	r = (((pixel&0x7C00)>>10)<<3);		 			\
    2.31 -	g = (((pixel&0x03E0)>>5)<<3); 					\
    2.32 -	b = ((pixel&0x001F)<<3); 					\
    2.33 +	r = (((Pixel&0x7C00)>>10)<<3);		 			\
    2.34 +	g = (((Pixel&0x03E0)>>5)<<3); 					\
    2.35 +	b = ((Pixel&0x001F)<<3); 					\
    2.36  }
    2.37 -#define RGB_FROM_RGB888(pixel, r, g, b)					\
    2.38 +#define RGB_FROM_RGB888(Pixel, r, g, b)					\
    2.39  {									\
    2.40 -	r = ((pixel&0xFF0000)>>16);		 			\
    2.41 -	g = ((pixel&0xFF00)>>8);		 			\
    2.42 -	b = (pixel&0xFF);			 			\
    2.43 +	r = ((Pixel&0xFF0000)>>16);		 			\
    2.44 +	g = ((Pixel&0xFF00)>>8);		 			\
    2.45 +	b = (Pixel&0xFF);			 			\
    2.46  }
    2.47 -#define RETRIEVE_RGB_PIXEL(buf, bpp, pixel)				   \
    2.48 +#define RETRIEVE_RGB_PIXEL(buf, bpp, Pixel)				   \
    2.49  do {									   \
    2.50  	switch (bpp) {							   \
    2.51  		case 2:							   \
    2.52 -			pixel = *((Uint16 *)(buf));			   \
    2.53 +			Pixel = *((Uint16 *)(buf));			   \
    2.54  		break;							   \
    2.55  									   \
    2.56  		case 3: {						   \
    2.57  		        Uint8 *B = (Uint8 *)(buf);			   \
    2.58  			if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {		   \
    2.59 -			        pixel = B[0] + (B[1] << 8) + (B[2] << 16); \
    2.60 +			        Pixel = B[0] + (B[1] << 8) + (B[2] << 16); \
    2.61  			} else {					   \
    2.62 -			        pixel = (B[0] << 16) + (B[1] << 8) + B[2]; \
    2.63 +			        Pixel = (B[0] << 16) + (B[1] << 8) + B[2]; \
    2.64  			}						   \
    2.65  		}							   \
    2.66  		break;							   \
    2.67  									   \
    2.68  		case 4:							   \
    2.69 -			pixel = *((Uint32 *)(buf));			   \
    2.70 +			Pixel = *((Uint32 *)(buf));			   \
    2.71  		break;							   \
    2.72  									   \
    2.73  		default:						   \
    2.74 -			pixel = 0; /* appease gcc */			   \
    2.75 +			Pixel = 0; /* appease gcc */			   \
    2.76  		break;							   \
    2.77  	}								   \
    2.78  } while(0)
    2.79  
    2.80 -#define DISEMBLE_RGB(buf, bpp, fmt, pixel, r, g, b)			   \
    2.81 +#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)			   \
    2.82  do {									   \
    2.83  	switch (bpp) {							   \
    2.84  		case 2:							   \
    2.85 -			pixel = *((Uint16 *)(buf));			   \
    2.86 +			Pixel = *((Uint16 *)(buf));			   \
    2.87  		break;							   \
    2.88  									   \
    2.89  		case 3: {						   \
    2.90  		        Uint8 *B = (Uint8 *)buf;			   \
    2.91  			if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {		   \
    2.92 -			        pixel = B[0] + (B[1] << 8) + (B[2] << 16); \
    2.93 +			        Pixel = B[0] + (B[1] << 8) + (B[2] << 16); \
    2.94  			} else {					   \
    2.95 -			        pixel = (B[0] << 16) + (B[1] << 8) + B[2]; \
    2.96 +			        Pixel = (B[0] << 16) + (B[1] << 8) + B[2]; \
    2.97  			}						   \
    2.98  		}							   \
    2.99  		break;							   \
   2.100  									   \
   2.101  		case 4:							   \
   2.102 -			pixel = *((Uint32 *)(buf));			   \
   2.103 +			Pixel = *((Uint32 *)(buf));			   \
   2.104  		break;							   \
   2.105  									   \
   2.106  	        default:						   \
   2.107 -		        pixel = 0;	/* prevent gcc from complaining */ \
   2.108 +		        Pixel = 0;	/* prevent gcc from complaining */ \
   2.109  		break;							   \
   2.110  	}								   \
   2.111 -	RGB_FROM_PIXEL(pixel, fmt, r, g, b);				   \
   2.112 +	RGB_FROM_PIXEL(Pixel, fmt, r, g, b);				   \
   2.113  } while(0)
   2.114  
   2.115  /* Assemble R-G-B values into a specified pixel format and store them */
   2.116 -#define PIXEL_FROM_RGB(pixel, fmt, r, g, b)				\
   2.117 +#define PIXEL_FROM_RGB(Pixel, fmt, r, g, b)				\
   2.118  {									\
   2.119 -	pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|				\
   2.120 +	Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|				\
   2.121  		((g>>fmt->Gloss)<<fmt->Gshift)|				\
   2.122  		((b>>fmt->Bloss)<<fmt->Bshift);				\
   2.123  }
   2.124 -#define RGB565_FROM_RGB(pixel, r, g, b)					\
   2.125 +#define RGB565_FROM_RGB(Pixel, r, g, b)					\
   2.126  {									\
   2.127 -	pixel = ((r>>3)<<11)|((g>>2)<<5)|(b>>3);			\
   2.128 +	Pixel = ((r>>3)<<11)|((g>>2)<<5)|(b>>3);			\
   2.129  }
   2.130 -#define RGB555_FROM_RGB(pixel, r, g, b)					\
   2.131 +#define RGB555_FROM_RGB(Pixel, r, g, b)					\
   2.132  {									\
   2.133 -	pixel = ((r>>3)<<10)|((g>>3)<<5)|(b>>3);			\
   2.134 +	Pixel = ((r>>3)<<10)|((g>>3)<<5)|(b>>3);			\
   2.135  }
   2.136 -#define RGB888_FROM_RGB(pixel, r, g, b)					\
   2.137 +#define RGB888_FROM_RGB(Pixel, r, g, b)					\
   2.138  {									\
   2.139 -	pixel = (r<<16)|(g<<8)|b;					\
   2.140 +	Pixel = (r<<16)|(g<<8)|b;					\
   2.141  }
   2.142  #define ASSEMBLE_RGB(buf, bpp, fmt, r, g, b) 				\
   2.143  {									\
   2.144  	switch (bpp) {							\
   2.145  		case 2: {						\
   2.146 -			Uint16 pixel;					\
   2.147 +			Uint16 Pixel;					\
   2.148  									\
   2.149 -			PIXEL_FROM_RGB(pixel, fmt, r, g, b);		\
   2.150 -			*((Uint16 *)(buf)) = pixel;			\
   2.151 +			PIXEL_FROM_RGB(Pixel, fmt, r, g, b);		\
   2.152 +			*((Uint16 *)(buf)) = Pixel;			\
   2.153  		}							\
   2.154  		break;							\
   2.155  									\
   2.156 @@ -213,10 +213,10 @@
   2.157  		break;							\
   2.158  									\
   2.159  		case 4: {						\
   2.160 -			Uint32 pixel;					\
   2.161 +			Uint32 Pixel;					\
   2.162  									\
   2.163 -			PIXEL_FROM_RGB(pixel, fmt, r, g, b);		\
   2.164 -			*((Uint32 *)(buf)) = pixel;			\
   2.165 +			PIXEL_FROM_RGB(Pixel, fmt, r, g, b);		\
   2.166 +			*((Uint32 *)(buf)) = Pixel;			\
   2.167  		}							\
   2.168  		break;							\
   2.169  	}								\
   2.170 @@ -226,11 +226,11 @@
   2.171  	switch (bpp) {							\
   2.172  		case 2: {						\
   2.173  			Uint16 *bufp;					\
   2.174 -			Uint16 pixel;					\
   2.175 +			Uint16 Pixel;					\
   2.176  									\
   2.177  			bufp = (Uint16 *)buf;				\
   2.178 -			PIXEL_FROM_RGB(pixel, fmt, r, g, b);		\
   2.179 -			*bufp = pixel | (*bufp & Amask);		\
   2.180 +			PIXEL_FROM_RGB(Pixel, fmt, r, g, b);		\
   2.181 +			*bufp = Pixel | (*bufp & Amask);		\
   2.182  		}							\
   2.183  		break;							\
   2.184  									\
   2.185 @@ -249,85 +249,85 @@
   2.186  									\
   2.187  		case 4: {						\
   2.188  			Uint32 *bufp;					\
   2.189 -			Uint32 pixel;					\
   2.190 +			Uint32 Pixel;					\
   2.191  									\
   2.192  			bufp = (Uint32 *)buf;				\
   2.193 -			PIXEL_FROM_RGB(pixel, fmt, r, g, b);		\
   2.194 -			*bufp = pixel | (*bufp & Amask);		\
   2.195 +			PIXEL_FROM_RGB(Pixel, fmt, r, g, b);		\
   2.196 +			*bufp = Pixel | (*bufp & Amask);		\
   2.197  		}							\
   2.198  		break;							\
   2.199  	}								\
   2.200  }
   2.201  
   2.202  /* FIXME: Should we rescale alpha into 0..255 here? */
   2.203 -#define RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a)				\
   2.204 +#define RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a)				\
   2.205  {									\
   2.206 -	r = ((pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss; 		\
   2.207 -	g = ((pixel&fmt->Gmask)>>fmt->Gshift)<<fmt->Gloss; 		\
   2.208 -	b = ((pixel&fmt->Bmask)>>fmt->Bshift)<<fmt->Bloss; 		\
   2.209 -	a = ((pixel&fmt->Amask)>>fmt->Ashift)<<fmt->Aloss;	 	\
   2.210 +	r = ((Pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss; 		\
   2.211 +	g = ((Pixel&fmt->Gmask)>>fmt->Gshift)<<fmt->Gloss; 		\
   2.212 +	b = ((Pixel&fmt->Bmask)>>fmt->Bshift)<<fmt->Bloss; 		\
   2.213 +	a = ((Pixel&fmt->Amask)>>fmt->Ashift)<<fmt->Aloss;	 	\
   2.214  }
   2.215 -#define RGBA_FROM_8888(pixel, fmt, r, g, b, a)	\
   2.216 +#define RGBA_FROM_8888(Pixel, fmt, r, g, b, a)	\
   2.217  {						\
   2.218 -	r = (pixel&fmt->Rmask)>>fmt->Rshift;	\
   2.219 -	g = (pixel&fmt->Gmask)>>fmt->Gshift;	\
   2.220 -	b = (pixel&fmt->Bmask)>>fmt->Bshift;	\
   2.221 -	a = (pixel&fmt->Amask)>>fmt->Ashift;	\
   2.222 +	r = (Pixel&fmt->Rmask)>>fmt->Rshift;	\
   2.223 +	g = (Pixel&fmt->Gmask)>>fmt->Gshift;	\
   2.224 +	b = (Pixel&fmt->Bmask)>>fmt->Bshift;	\
   2.225 +	a = (Pixel&fmt->Amask)>>fmt->Ashift;	\
   2.226  }
   2.227 -#define RGBA_FROM_RGBA8888(pixel, r, g, b, a)				\
   2.228 +#define RGBA_FROM_RGBA8888(Pixel, r, g, b, a)				\
   2.229  {									\
   2.230 -	r = (pixel>>24);						\
   2.231 -	g = ((pixel>>16)&0xFF);						\
   2.232 -	b = ((pixel>>8)&0xFF);						\
   2.233 -	a = (pixel&0xFF);						\
   2.234 +	r = (Pixel>>24);						\
   2.235 +	g = ((Pixel>>16)&0xFF);						\
   2.236 +	b = ((Pixel>>8)&0xFF);						\
   2.237 +	a = (Pixel&0xFF);						\
   2.238  }
   2.239 -#define RGBA_FROM_ARGB8888(pixel, r, g, b, a)				\
   2.240 +#define RGBA_FROM_ARGB8888(Pixel, r, g, b, a)				\
   2.241  {									\
   2.242 -	r = ((pixel>>16)&0xFF);						\
   2.243 -	g = ((pixel>>8)&0xFF);						\
   2.244 -	b = (pixel&0xFF);						\
   2.245 -	a = (pixel>>24);						\
   2.246 +	r = ((Pixel>>16)&0xFF);						\
   2.247 +	g = ((Pixel>>8)&0xFF);						\
   2.248 +	b = (Pixel&0xFF);						\
   2.249 +	a = (Pixel>>24);						\
   2.250  }
   2.251 -#define RGBA_FROM_ABGR8888(pixel, r, g, b, a)				\
   2.252 +#define RGBA_FROM_ABGR8888(Pixel, r, g, b, a)				\
   2.253  {									\
   2.254 -	r = (pixel&0xFF);						\
   2.255 -	g = ((pixel>>8)&0xFF);						\
   2.256 -	b = ((pixel>>16)&0xFF);						\
   2.257 -	a = (pixel>>24);						\
   2.258 +	r = (Pixel&0xFF);						\
   2.259 +	g = ((Pixel>>8)&0xFF);						\
   2.260 +	b = ((Pixel>>16)&0xFF);						\
   2.261 +	a = (Pixel>>24);						\
   2.262  }
   2.263 -#define DISEMBLE_RGBA(buf, bpp, fmt, pixel, r, g, b, a)			   \
   2.264 +#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a)			   \
   2.265  do {									   \
   2.266  	switch (bpp) {							   \
   2.267  		case 2:							   \
   2.268 -			pixel = *((Uint16 *)(buf));			   \
   2.269 +			Pixel = *((Uint16 *)(buf));			   \
   2.270  		break;							   \
   2.271  									   \
   2.272  		case 3:	{/* FIXME: broken code (no alpha) */		   \
   2.273  		        Uint8 *b = (Uint8 *)buf;			   \
   2.274  			if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {		   \
   2.275 -			        pixel = b[0] + (b[1] << 8) + (b[2] << 16); \
   2.276 +			        Pixel = b[0] + (b[1] << 8) + (b[2] << 16); \
   2.277  			} else {					   \
   2.278 -			        pixel = (b[0] << 16) + (b[1] << 8) + b[2]; \
   2.279 +			        Pixel = (b[0] << 16) + (b[1] << 8) + b[2]; \
   2.280  			}						   \
   2.281  		}							   \
   2.282  		break;							   \
   2.283  									   \
   2.284  		case 4:							   \
   2.285 -			pixel = *((Uint32 *)(buf));			   \
   2.286 +			Pixel = *((Uint32 *)(buf));			   \
   2.287  		break;							   \
   2.288  									   \
   2.289  		default:						   \
   2.290 -		        pixel = 0; /* stop gcc complaints */		   \
   2.291 +		        Pixel = 0; /* stop gcc complaints */		   \
   2.292  		break;							   \
   2.293  	}								   \
   2.294 -	RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a);			   \
   2.295 -	pixel &= ~fmt->Amask;						   \
   2.296 +	RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a);			   \
   2.297 +	Pixel &= ~fmt->Amask;						   \
   2.298  } while(0)
   2.299  
   2.300  /* FIXME: this isn't correct, especially for Alpha (maximum != 255) */
   2.301 -#define PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a)				\
   2.302 +#define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a)				\
   2.303  {									\
   2.304 -	pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|				\
   2.305 +	Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|				\
   2.306  		((g>>fmt->Gloss)<<fmt->Gshift)|				\
   2.307  		((b>>fmt->Bloss)<<fmt->Bshift)|				\
   2.308  		((a>>fmt->Aloss)<<fmt->Ashift);				\
   2.309 @@ -336,10 +336,10 @@
   2.310  {									\
   2.311  	switch (bpp) {							\
   2.312  		case 2: {						\
   2.313 -			Uint16 pixel;					\
   2.314 +			Uint16 Pixel;					\
   2.315  									\
   2.316 -			PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a);	\
   2.317 -			*((Uint16 *)(buf)) = pixel;			\
   2.318 +			PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a);	\
   2.319 +			*((Uint16 *)(buf)) = Pixel;			\
   2.320  		}							\
   2.321  		break;							\
   2.322  									\
   2.323 @@ -357,16 +357,16 @@
   2.324  		break;							\
   2.325  									\
   2.326  		case 4: {						\
   2.327 -			Uint32 pixel;					\
   2.328 +			Uint32 Pixel;					\
   2.329  									\
   2.330 -			PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a);	\
   2.331 -			*((Uint32 *)(buf)) = pixel;			\
   2.332 +			PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a);	\
   2.333 +			*((Uint32 *)(buf)) = Pixel;			\
   2.334  		}							\
   2.335  		break;							\
   2.336  	}								\
   2.337  }
   2.338  
   2.339 -/* Blend the RGB values of two pixels based on a source alpha value */
   2.340 +/* Blend the RGB values of two Pixels based on a source alpha value */
   2.341  #define ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB)	\
   2.342  do {						\
   2.343  	dR = (((sR-dR)*(A))>>8)+dR;		\
   2.344 @@ -374,7 +374,7 @@
   2.345  	dB = (((sB-dB)*(A))>>8)+dB;		\
   2.346  } while(0)
   2.347  
   2.348 -/* Blend the RGB values of two pixels based on a source alpha value */
   2.349 +/* Blend the RGB values of two Pixels based on a source alpha value */
   2.350  #define ACCURATE_ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB)	\
   2.351  do {						\
   2.352      unsigned tR, tG, tB, tA; \
     3.1 --- a/src/video/SDL_blit_A.c	Thu Oct 20 06:53:56 2005 +0000
     3.2 +++ b/src/video/SDL_blit_A.c	Thu Oct 20 06:55:26 2005 +0000
     3.3 @@ -62,14 +62,14 @@
     3.4  	while ( height-- ) {
     3.5  	    DUFFS_LOOP4(
     3.6  	    {
     3.7 -		Uint32 pixel;
     3.8 +		Uint32 Pixel;
     3.9  		unsigned sR;
    3.10  		unsigned sG;
    3.11  		unsigned sB;
    3.12  		unsigned dR;
    3.13  		unsigned dG;
    3.14  		unsigned dB;
    3.15 -		DISEMBLE_RGB(src, srcbpp, srcfmt, pixel, sR, sG, sB);
    3.16 +		DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
    3.17  		dR = dstfmt->palette->colors[*dst].r;
    3.18  		dG = dstfmt->palette->colors[*dst].g;
    3.19  		dB = dstfmt->palette->colors[*dst].b;
    3.20 @@ -114,7 +114,7 @@
    3.21  	while ( height-- ) {
    3.22  	    DUFFS_LOOP4(
    3.23  	    {
    3.24 -		Uint32 pixel;
    3.25 +		Uint32 Pixel;
    3.26  		unsigned sR;
    3.27  		unsigned sG;
    3.28  		unsigned sB;
    3.29 @@ -122,7 +122,7 @@
    3.30  		unsigned dR;
    3.31  		unsigned dG;
    3.32  		unsigned dB;
    3.33 -		DISEMBLE_RGBA(src,srcbpp,srcfmt,pixel,sR,sG,sB,sA);
    3.34 +		DISEMBLE_RGBA(src,srcbpp,srcfmt,Pixel,sR,sG,sB,sA);
    3.35  		dR = dstfmt->palette->colors[*dst].r;
    3.36  		dG = dstfmt->palette->colors[*dst].g;
    3.37  		dB = dstfmt->palette->colors[*dst].b;
    3.38 @@ -169,15 +169,15 @@
    3.39  	while ( height-- ) {
    3.40  	    DUFFS_LOOP(
    3.41  	    {
    3.42 -		Uint32 pixel;
    3.43 +		Uint32 Pixel;
    3.44  		unsigned sR;
    3.45  		unsigned sG;
    3.46  		unsigned sB;
    3.47  		unsigned dR;
    3.48  		unsigned dG;
    3.49  		unsigned dB;
    3.50 -		DISEMBLE_RGB(src, srcbpp, srcfmt, pixel, sR, sG, sB);
    3.51 -		if ( pixel != ckey ) {
    3.52 +		DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
    3.53 +		if ( Pixel != ckey ) {
    3.54  		    dR = dstfmt->palette->colors[*dst].r;
    3.55  		    dG = dstfmt->palette->colors[*dst].g;
    3.56  		    dB = dstfmt->palette->colors[*dst].b;
    3.57 @@ -298,7 +298,7 @@
    3.58  	                        pand_r2r(mm3, mm2); /* 0A0R0G0B -> mm2 */
    3.59  	                        packuswb_r2r(mm2, mm2);  /* ARGBARGB -> mm2 */
    3.60  	                        por_r2r(mm7, mm2); /* mm7(full alpha) | mm2 -> mm2 */
    3.61 -			        movd_r2m(mm2, *dstp);/* mm2 -> pixel */
    3.62 +			        movd_r2m(mm2, *dstp);/* mm2 -> Pixel */
    3.63  				++srcp;
    3.64  				++dstp;
    3.65  			},{
    3.66 @@ -334,7 +334,7 @@
    3.67  	                        psllq_i2r(32, mm6); /* mm6 << 32 -> mm6 */
    3.68  	                        por_r2r(mm6, mm2); /* mm6 | mm2 -> mm2 */				
    3.69  				por_r2r(mm7, mm2); /* mm7(full alpha) | mm2 -> mm2 */
    3.70 -                                movq_r2m(mm2, *dstp);/* mm2 -> 2 x pixel */
    3.71 +                                movq_r2m(mm2, *dstp);/* mm2 -> 2 x Pixel */
    3.72  				srcp += 2;
    3.73  				dstp += 2;
    3.74  			}, width);
    3.75 @@ -422,7 +422,21 @@
    3.76  #endif
    3.77  
    3.78  #ifdef USE_ALTIVEC_BLITTERS
    3.79 +#include <altivec.h>
    3.80  #include <assert.h>
    3.81 +
    3.82 +#if ((defined MACOSX) && (__GNUC__ < 4))
    3.83 +    #define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
    3.84 +        (vector unsigned char) ( a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p )
    3.85 +    #define VECUINT16_LITERAL(a,b,c,d,e,f,g,h) \
    3.86 +        (vector unsigned short) ( a,b,c,d,e,f,g,h )
    3.87 +#else
    3.88 +    #define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
    3.89 +        (vector unsigned char) { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p }
    3.90 +    #define VECUINT16_LITERAL(a,b,c,d,e,f,g,h) \
    3.91 +        (vector unsigned short) { a,b,c,d,e,f,g,h }
    3.92 +#endif
    3.93 +
    3.94  #define UNALIGNED_PTR(x) (((size_t) x) & 0x0000000F)
    3.95  #define VECPRINT(msg, v) do { \
    3.96      vector unsigned int tmpvec = (vector unsigned int)(v); \
    3.97 @@ -493,7 +507,7 @@
    3.98      if (!dstfmt) {
    3.99          dstfmt = &default_pixel_format;
   3.100      }
   3.101 -    vector unsigned char plus = (vector unsigned char)
   3.102 +    vector unsigned char plus = VECUINT8_LITERAL
   3.103                                              ( 0x00, 0x00, 0x00, 0x00,
   3.104                                                0x04, 0x04, 0x04, 0x04,
   3.105                                                0x08, 0x08, 0x08, 0x08,
   3.106 @@ -512,7 +526,7 @@
   3.107          amask = 0x10101010 & ((dstfmt->Rmask | dstfmt->Gmask | dstfmt->Bmask) ^ 0xFFFFFFFF);
   3.108      }
   3.109  #undef RESHIFT  
   3.110 -    ((unsigned int *)&srcvec)[0] = (rmask | gmask | bmask | amask);
   3.111 +    ((unsigned int *)(char*)&srcvec)[0] = (rmask | gmask | bmask | amask);
   3.112      vswiz = vec_add(plus, (vector unsigned char)vec_splat(srcvec, 0));
   3.113      return(vswiz);
   3.114  }
   3.115 @@ -533,10 +547,10 @@
   3.116      vector unsigned short v3_16 = vec_splat_u16(3);
   3.117      vector unsigned int v8_32 = vec_splat_u32(8);
   3.118      vector unsigned int v16_32 = vec_add(v8_32, v8_32);
   3.119 -    vector unsigned short v3f = (vector unsigned short)(
   3.120 +    vector unsigned short v3f = VECUINT16_LITERAL(
   3.121          0x003f, 0x003f, 0x003f, 0x003f,
   3.122          0x003f, 0x003f, 0x003f, 0x003f);
   3.123 -    vector unsigned short vfc = (vector unsigned short)(
   3.124 +    vector unsigned short vfc = VECUINT16_LITERAL(
   3.125          0x00fc, 0x00fc, 0x00fc, 0x00fc,
   3.126          0x00fc, 0x00fc, 0x00fc, 0x00fc);
   3.127  
   3.128 @@ -545,7 +559,7 @@
   3.129          0x00 - 0x0e evens are the red
   3.130          0x01 - 0x0f odds are zero
   3.131      */
   3.132 -    vector unsigned char vredalpha1 = (vector unsigned char)(
   3.133 +    vector unsigned char vredalpha1 = VECUINT8_LITERAL(
   3.134          0x10, 0x00, 0x01, 0x01,
   3.135          0x10, 0x02, 0x01, 0x01,
   3.136          0x10, 0x04, 0x01, 0x01,
   3.137 @@ -558,7 +572,7 @@
   3.138          0x00 - 0x0f is ARxx ARxx ARxx ARxx
   3.139          0x11 - 0x0f odds are blue
   3.140      */
   3.141 -    vector unsigned char vblue1 = (vector unsigned char)(
   3.142 +    vector unsigned char vblue1 = VECUINT8_LITERAL(
   3.143          0x00, 0x01, 0x02, 0x11,
   3.144          0x04, 0x05, 0x06, 0x13,
   3.145          0x08, 0x09, 0x0a, 0x15,
   3.146 @@ -571,7 +585,7 @@
   3.147          0x00 - 0x0f is ARxB ARxB ARxB ARxB
   3.148          0x10 - 0x0e evens are green
   3.149      */
   3.150 -    vector unsigned char vgreen1 = (vector unsigned char)(
   3.151 +    vector unsigned char vgreen1 = VECUINT8_LITERAL(
   3.152          0x00, 0x01, 0x10, 0x03,
   3.153          0x04, 0x05, 0x12, 0x07,
   3.154          0x08, 0x09, 0x14, 0x0b,
   3.155 @@ -580,7 +594,7 @@
   3.156      vector unsigned char vgreen2 = (vector unsigned char)(
   3.157          vec_add((vector unsigned int)vgreen1, vec_sl(v8_32, v8_32))
   3.158      );
   3.159 -    vector unsigned char vgmerge = (vector unsigned char)(
   3.160 +    vector unsigned char vgmerge = VECUINT8_LITERAL(
   3.161          0x00, 0x02, 0x00, 0x06,
   3.162          0x00, 0x0a, 0x00, 0x0e,
   3.163          0x00, 0x12, 0x00, 0x16,
   3.164 @@ -601,9 +615,9 @@
   3.165  
   3.166  #define ONE_PIXEL_BLEND(condition, widthvar) \
   3.167          while (condition) { \
   3.168 -            Uint32 pixel; \
   3.169 +            Uint32 Pixel; \
   3.170              unsigned sR, sG, sB, dR, dG, dB, sA; \
   3.171 -            DISEMBLE_RGBA(src, 4, srcfmt, pixel, sR, sG, sB, sA); \
   3.172 +            DISEMBLE_RGBA(src, 4, srcfmt, Pixel, sR, sG, sB, sA); \
   3.173              if(sA) { \
   3.174                  unsigned short dstpixel = *((unsigned short *)dst); \
   3.175                  dR = (dstpixel >> 8) & 0xf8; \
   3.176 @@ -727,26 +741,26 @@
   3.177      vbits = (vector unsigned char)vec_splat_s8(-1);
   3.178  
   3.179      ckey &= rgbmask;
   3.180 -    ((unsigned int *)&vckey)[0] = ckey;
   3.181 +    ((unsigned int *)(char*)&vckey)[0] = ckey;
   3.182      vckey = vec_splat(vckey, 0);
   3.183 -    ((unsigned int *)&vrgbmask)[0] = rgbmask;
   3.184 +    ((unsigned int *)(char*)&vrgbmask)[0] = rgbmask;
   3.185      vrgbmask = vec_splat(vrgbmask, 0);
   3.186  
   3.187      while(height--) {
   3.188          int width = info->d_width;
   3.189  #define ONE_PIXEL_BLEND(condition, widthvar) \
   3.190          while (condition) { \
   3.191 -            Uint32 pixel; \
   3.192 +            Uint32 Pixel; \
   3.193              unsigned sR, sG, sB, dR, dG, dB; \
   3.194 -            RETRIEVE_RGB_PIXEL(((Uint8 *)srcp), 4, pixel); \
   3.195 -            if(sA && pixel != ckey) { \
   3.196 -                RGB_FROM_PIXEL(pixel, srcfmt, sR, sG, sB); \
   3.197 -                DISEMBLE_RGB(((Uint8 *)dstp), 4, dstfmt, pixel, dR, dG, dB); \
   3.198 +            RETRIEVE_RGB_PIXEL(((Uint8 *)srcp), 4, Pixel); \
   3.199 +            if(sA && Pixel != ckey) { \
   3.200 +                RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB); \
   3.201 +                DISEMBLE_RGB(((Uint8 *)dstp), 4, dstfmt, Pixel, dR, dG, dB); \
   3.202                  ACCURATE_ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB); \
   3.203                  ASSEMBLE_RGBA(((Uint8 *)dstp), 4, dstfmt, dR, dG, dB, dA); \
   3.204              } \
   3.205 -            ((Uint8 *)dstp) += 4; \
   3.206 -            ((Uint8 *)srcp) += 4; \
   3.207 +            dstp++; \
   3.208 +            srcp++; \
   3.209              widthvar--; \
   3.210          }
   3.211          ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width);
   3.212 @@ -840,11 +854,11 @@
   3.213  	while ( height-- ) {
   3.214          width = info->d_width;
   3.215  #define ONE_PIXEL_BLEND(condition, widthvar) while ((condition)) { \
   3.216 -            Uint32 pixel; \
   3.217 +            Uint32 Pixel; \
   3.218              unsigned sR, sG, sB, dR, dG, dB, sA, dA; \
   3.219 -            DISEMBLE_RGBA((Uint8 *)srcp, 4, srcfmt, pixel, sR, sG, sB, sA); \
   3.220 +            DISEMBLE_RGBA((Uint8 *)srcp, 4, srcfmt, Pixel, sR, sG, sB, sA); \
   3.221              if(sA) { \
   3.222 -              DISEMBLE_RGBA((Uint8 *)dstp, 4, dstfmt, pixel, dR, dG, dB, dA); \
   3.223 +              DISEMBLE_RGBA((Uint8 *)dstp, 4, dstfmt, Pixel, dR, dG, dB, dA); \
   3.224                ACCURATE_ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB); \
   3.225                ASSEMBLE_RGBA((Uint8 *)dstp, 4, dstfmt, dR, dG, dB, dA); \
   3.226              } \
   3.227 @@ -1040,10 +1054,10 @@
   3.228      while(height--) {
   3.229          int width = info->d_width;
   3.230  #define ONE_PIXEL_BLEND(condition, widthvar) while ((condition)) { \
   3.231 -            Uint32 pixel; \
   3.232 +            Uint32 Pixel; \
   3.233              unsigned sR, sG, sB, dR, dG, dB; \
   3.234 -            DISEMBLE_RGB(((Uint8 *)srcp), 4, srcfmt, pixel, sR, sG, sB); \
   3.235 -            DISEMBLE_RGB(((Uint8 *)dstp), 4, dstfmt, pixel, dR, dG, dB); \
   3.236 +            DISEMBLE_RGB(((Uint8 *)srcp), 4, srcfmt, Pixel, sR, sG, sB); \
   3.237 +            DISEMBLE_RGB(((Uint8 *)dstp), 4, dstfmt, Pixel, dR, dG, dB); \
   3.238              ACCURATE_ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB); \
   3.239              ASSEMBLE_RGBA(((Uint8 *)dstp), 4, dstfmt, dR, dG, dB, dA); \
   3.240              ++srcp; \
   3.241 @@ -2002,15 +2016,15 @@
   3.242  	  while ( height-- ) {
   3.243  	    DUFFS_LOOP4(
   3.244  	    {
   3.245 -		Uint32 pixel;
   3.246 +		Uint32 Pixel;
   3.247  		unsigned sR;
   3.248  		unsigned sG;
   3.249  		unsigned sB;
   3.250  		unsigned dR;
   3.251  		unsigned dG;
   3.252  		unsigned dB;
   3.253 -		DISEMBLE_RGB(src, srcbpp, srcfmt, pixel, sR, sG, sB);
   3.254 -		DISEMBLE_RGB(dst, dstbpp, dstfmt, pixel, dR, dG, dB);
   3.255 +		DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
   3.256 +		DISEMBLE_RGB(dst, dstbpp, dstfmt, Pixel, dR, dG, dB);
   3.257  		ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB);
   3.258  		ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
   3.259  		src += srcbpp;
   3.260 @@ -2043,17 +2057,17 @@
   3.261  	while ( height-- ) {
   3.262  	    DUFFS_LOOP4(
   3.263  	    {
   3.264 -		Uint32 pixel;
   3.265 +		Uint32 Pixel;
   3.266  		unsigned sR;
   3.267  		unsigned sG;
   3.268  		unsigned sB;
   3.269  		unsigned dR;
   3.270  		unsigned dG;
   3.271  		unsigned dB;
   3.272 -		RETRIEVE_RGB_PIXEL(src, srcbpp, pixel);
   3.273 -		if(sA && pixel != ckey) {
   3.274 -		    RGB_FROM_PIXEL(pixel, srcfmt, sR, sG, sB);
   3.275 -		    DISEMBLE_RGB(dst, dstbpp, dstfmt, pixel, dR, dG, dB);
   3.276 +		RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel);
   3.277 +		if(sA && Pixel != ckey) {
   3.278 +		    RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB);
   3.279 +		    DISEMBLE_RGB(dst, dstbpp, dstfmt, Pixel, dR, dG, dB);
   3.280  		    ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB);
   3.281  		    ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
   3.282  		}
   3.283 @@ -2093,7 +2107,7 @@
   3.284  	while ( height-- ) {
   3.285  	    DUFFS_LOOP4(
   3.286  	    {
   3.287 -		Uint32 pixel;
   3.288 +		Uint32 Pixel;
   3.289  		unsigned sR;
   3.290  		unsigned sG;
   3.291  		unsigned sB;
   3.292 @@ -2102,9 +2116,9 @@
   3.293  		unsigned dB;
   3.294  		unsigned sA;
   3.295  		unsigned dA;
   3.296 -		DISEMBLE_RGBA(src, srcbpp, srcfmt, pixel, sR, sG, sB, sA);
   3.297 +		DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
   3.298  		if(sA) {
   3.299 -		  DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
   3.300 +		  DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA);
   3.301  		  ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB);
   3.302  		  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
   3.303  		}
     4.1 --- a/src/video/SDL_blit_N.c	Thu Oct 20 06:53:56 2005 +0000
     4.2 +++ b/src/video/SDL_blit_N.c	Thu Oct 20 06:55:26 2005 +0000
     4.3 @@ -36,10 +36,11 @@
     4.4  /* Functions to blit from N-bit surfaces to other surfaces */
     4.5  
     4.6  #ifdef USE_ALTIVEC_BLITTERS
     4.7 +#include <altivec.h>
     4.8  #include <assert.h>
     4.9 +#include <stdlib.h>
    4.10  #ifdef MACOSX
    4.11  #include <sys/sysctl.h>
    4.12 -#include <stdlib.h>
    4.13  static size_t GetL3CacheSize( void )
    4.14  {
    4.15      const char key[] = "hw.l3cachesize";
    4.16 @@ -60,6 +61,18 @@
    4.17  }
    4.18  #endif /* MACOSX */
    4.19  
    4.20 +#if ((defined MACOSX) && (__GNUC__ < 4))
    4.21 +    #define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
    4.22 +        (vector unsigned char) ( a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p )
    4.23 +    #define VECUINT16_LITERAL(a,b,c,d,e,f,g,h) \
    4.24 +        (vector unsigned short) ( a,b,c,d,e,f,g,h )
    4.25 +#else
    4.26 +    #define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
    4.27 +        (vector unsigned char) { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p }
    4.28 +    #define VECUINT16_LITERAL(a,b,c,d,e,f,g,h) \
    4.29 +        (vector unsigned short) { a,b,c,d,e,f,g,h }
    4.30 +#endif
    4.31 +
    4.32  #define UNALIGNED_PTR(x) (((size_t) x) & 0x0000000F)
    4.33  #define VSWIZZLE32(a,b,c,d) (vector unsigned char) \
    4.34                                 ( 0x00+a, 0x00+b, 0x00+c, 0x00+d, \
    4.35 @@ -112,7 +125,8 @@
    4.36      if (!dstfmt) {
    4.37          dstfmt = &default_pixel_format;
    4.38      }
    4.39 -    vector unsigned char plus = (vector unsigned char)( 0x00, 0x00, 0x00, 0x00,
    4.40 +    vector unsigned char plus = VECUINT8_LITERAL(
    4.41 +                                      0x00, 0x00, 0x00, 0x00,
    4.42                                        0x04, 0x04, 0x04, 0x04,
    4.43                                        0x08, 0x08, 0x08, 0x08,
    4.44                                        0x0C, 0x0C, 0x0C, 0x0C );
    4.45 @@ -130,7 +144,7 @@
    4.46          amask = 0x10101010 & ((dstfmt->Rmask | dstfmt->Gmask | dstfmt->Bmask) ^ 0xFFFFFFFF);
    4.47      }           
    4.48  #undef RESHIFT  
    4.49 -    ((unsigned int *)&srcvec)[0] = (rmask | gmask | bmask | amask);
    4.50 +    ((unsigned int *)(char*)&srcvec)[0] = (rmask | gmask | bmask | amask);
    4.51      vswiz = vec_add(plus, (vector unsigned char)vec_splat(srcvec, 0));
    4.52      return(vswiz);
    4.53  }
    4.54 @@ -145,17 +159,17 @@
    4.55      SDL_PixelFormat *srcfmt = info->src;
    4.56      vector unsigned char valpha = vec_splat_u8(0);
    4.57      vector unsigned char vpermute = calc_swizzle32(srcfmt, NULL);
    4.58 -    vector unsigned char vgmerge = (vector unsigned char)(
    4.59 +    vector unsigned char vgmerge = VECUINT8_LITERAL(
    4.60          0x00, 0x02, 0x00, 0x06,
    4.61          0x00, 0x0a, 0x00, 0x0e,
    4.62          0x00, 0x12, 0x00, 0x16,
    4.63          0x00, 0x1a, 0x00, 0x1e);
    4.64      vector unsigned short v1 = vec_splat_u16(1);
    4.65      vector unsigned short v3 = vec_splat_u16(3);
    4.66 -    vector unsigned short v3f = (vector unsigned short)(
    4.67 +    vector unsigned short v3f = VECUINT16_LITERAL(
    4.68          0x003f, 0x003f, 0x003f, 0x003f,
    4.69          0x003f, 0x003f, 0x003f, 0x003f);
    4.70 -    vector unsigned short vfc = (vector unsigned short)(
    4.71 +    vector unsigned short vfc = VECUINT16_LITERAL(
    4.72          0x00fc, 0x00fc, 0x00fc, 0x00fc,
    4.73          0x00fc, 0x00fc, 0x00fc, 0x00fc);
    4.74      vector unsigned short vf800 = (vector unsigned short)vec_splat_u8(-7);
    4.75 @@ -172,9 +186,9 @@
    4.76          /* do scalar until we can align... */
    4.77  #define ONE_PIXEL_BLEND(condition, widthvar) \
    4.78          while (condition) { \
    4.79 -            Uint32 pixel; \
    4.80 +            Uint32 Pixel; \
    4.81              unsigned sR, sG, sB, sA; \
    4.82 -            DISEMBLE_RGBA((Uint8 *)src, 4, srcfmt, pixel, \
    4.83 +            DISEMBLE_RGBA((Uint8 *)src, 4, srcfmt, Pixel, \
    4.84                            sR, sG, sB, sA); \
    4.85              *(Uint16 *)(dst) = (((sR << 8) & 0x0000F800) | \
    4.86                                  ((sG << 3) & 0x000007E0) | \
    4.87 @@ -259,20 +273,20 @@
    4.88          0x00 - 0x0e evens are the red
    4.89          0x01 - 0x0f odds are zero
    4.90      */
    4.91 -    vector unsigned char vredalpha1 = (vector unsigned char)(
    4.92 +    vector unsigned char vredalpha1 = VECUINT8_LITERAL(
    4.93          0x10, 0x00, 0x01, 0x01,
    4.94          0x10, 0x02, 0x01, 0x01,
    4.95          0x10, 0x04, 0x01, 0x01,
    4.96          0x10, 0x06, 0x01, 0x01
    4.97      );
    4.98 -    vector unsigned char vredalpha2 = (vector unsigned char)(
    4.99 +    vector unsigned char vredalpha2 = (vector unsigned char) (
   4.100          vec_add((vector unsigned int)vredalpha1, vec_sl(v8, v16))
   4.101      );
   4.102      /*
   4.103          0x00 - 0x0f is ARxx ARxx ARxx ARxx
   4.104          0x11 - 0x0f odds are blue
   4.105      */
   4.106 -    vector unsigned char vblue1 = (vector unsigned char)(
   4.107 +    vector unsigned char vblue1 = VECUINT8_LITERAL(
   4.108          0x00, 0x01, 0x02, 0x11,
   4.109          0x04, 0x05, 0x06, 0x13,
   4.110          0x08, 0x09, 0x0a, 0x15,
   4.111 @@ -285,7 +299,7 @@
   4.112          0x00 - 0x0f is ARxB ARxB ARxB ARxB
   4.113          0x10 - 0x0e evens are green
   4.114      */
   4.115 -    vector unsigned char vgreen1 = (vector unsigned char)(
   4.116 +    vector unsigned char vgreen1 = VECUINT8_LITERAL(
   4.117          0x00, 0x01, 0x10, 0x03,
   4.118          0x04, 0x05, 0x12, 0x07,
   4.119          0x08, 0x09, 0x14, 0x0b,
   4.120 @@ -323,10 +337,10 @@
   4.121  #define ONE_PIXEL_BLEND(condition, widthvar) \
   4.122          while (condition) { \
   4.123              unsigned sR, sG, sB; \
   4.124 -            unsigned short pixel = *((unsigned short *)src); \
   4.125 -            sR = (pixel >> 8) & 0xf8; \
   4.126 -            sG = (pixel >> 3) & 0xfc; \
   4.127 -            sB = (pixel << 3) & 0xf8; \
   4.128 +            unsigned short Pixel = *((unsigned short *)src); \
   4.129 +            sR = (Pixel >> 8) & 0xf8; \
   4.130 +            sG = (Pixel >> 3) & 0xfc; \
   4.131 +            sB = (Pixel << 3) & 0xf8; \
   4.132              ASSEMBLE_RGBA(dst, 4, dstfmt, sR, sG, sB, alpha); \
   4.133              src += 2; \
   4.134              dst += 4; \
   4.135 @@ -404,7 +418,7 @@
   4.136          0x00 - 0x0e evens are the red
   4.137          0x01 - 0x0f odds are zero
   4.138      */
   4.139 -    vector unsigned char vredalpha1 = (vector unsigned char)(
   4.140 +    vector unsigned char vredalpha1 = VECUINT8_LITERAL(
   4.141          0x10, 0x00, 0x01, 0x01,
   4.142          0x10, 0x02, 0x01, 0x01,
   4.143          0x10, 0x04, 0x01, 0x01,
   4.144 @@ -417,7 +431,7 @@
   4.145          0x00 - 0x0f is ARxx ARxx ARxx ARxx
   4.146          0x11 - 0x0f odds are blue
   4.147      */
   4.148 -    vector unsigned char vblue1 = (vector unsigned char)(
   4.149 +    vector unsigned char vblue1 = VECUINT8_LITERAL(
   4.150          0x00, 0x01, 0x02, 0x11,
   4.151          0x04, 0x05, 0x06, 0x13,
   4.152          0x08, 0x09, 0x0a, 0x15,
   4.153 @@ -430,7 +444,7 @@
   4.154          0x00 - 0x0f is ARxB ARxB ARxB ARxB
   4.155          0x10 - 0x0e evens are green
   4.156      */
   4.157 -    vector unsigned char vgreen1 = (vector unsigned char)(
   4.158 +    vector unsigned char vgreen1 = VECUINT8_LITERAL(
   4.159          0x00, 0x01, 0x10, 0x03,
   4.160          0x04, 0x05, 0x12, 0x07,
   4.161          0x08, 0x09, 0x14, 0x0b,
   4.162 @@ -468,10 +482,10 @@
   4.163  #define ONE_PIXEL_BLEND(condition, widthvar) \
   4.164          while (condition) { \
   4.165              unsigned sR, sG, sB; \
   4.166 -            unsigned short pixel = *((unsigned short *)src); \
   4.167 -            sR = (pixel >> 7) & 0xf8; \
   4.168 -            sG = (pixel >> 2) & 0xf8; \
   4.169 -            sB = (pixel << 3) & 0xf8; \
   4.170 +            unsigned short Pixel = *((unsigned short *)src); \
   4.171 +            sR = (Pixel >> 7) & 0xf8; \
   4.172 +            sG = (Pixel >> 2) & 0xf8; \
   4.173 +            sB = (Pixel << 3) & 0xf8; \
   4.174              ASSEMBLE_RGBA(dst, 4, dstfmt, sR, sG, sB, alpha); \
   4.175              src += 2; \
   4.176              dst += 4; \
   4.177 @@ -565,39 +579,39 @@
   4.178          valpha = (vector unsigned int)vzero;
   4.179      }
   4.180      ckey &= rgbmask;
   4.181 -    ((unsigned int *)&vckey)[0] = ckey;
   4.182 +    ((unsigned int *)(char*)&vckey)[0] = ckey;
   4.183      vckey = vec_splat(vckey, 0);
   4.184 -    ((unsigned int *)&vrgbmask)[0] = rgbmask;
   4.185 +    ((unsigned int *)(char*)&vrgbmask)[0] = rgbmask;
   4.186      vrgbmask = vec_splat(vrgbmask, 0);
   4.187  
   4.188      while (height--) {
   4.189  #define ONE_PIXEL_BLEND(condition, widthvar) \
   4.190          if (copy_alpha) { \
   4.191              while (condition) { \
   4.192 -                Uint32 pixel; \
   4.193 +                Uint32 Pixel; \
   4.194                  unsigned sR, sG, sB, sA; \
   4.195 -                DISEMBLE_RGBA((Uint8 *)srcp, srcbpp, srcfmt, pixel, \
   4.196 +                DISEMBLE_RGBA((Uint8 *)srcp, srcbpp, srcfmt, Pixel, \
   4.197                            sR, sG, sB, sA); \
   4.198 -                if ( (pixel & rgbmask) != ckey ) { \
   4.199 +                if ( (Pixel & rgbmask) != ckey ) { \
   4.200                        ASSEMBLE_RGBA((Uint8 *)dstp, dstbpp, dstfmt, \
   4.201                              sR, sG, sB, sA); \
   4.202                  } \
   4.203 -                ((Uint8 *)dstp) += dstbpp; \
   4.204 -                ((Uint8 *)srcp) += srcbpp; \
   4.205 +                dstp = (Uint32 *) (((Uint8 *) dstp) + dstbpp); \
   4.206 +                srcp = (Uint32 *) (((Uint8 *) srcp) + srcbpp); \
   4.207                  widthvar--; \
   4.208              } \
   4.209          } else { \
   4.210              while (condition) { \
   4.211 -                Uint32 pixel; \
   4.212 +                Uint32 Pixel; \
   4.213                  unsigned sR, sG, sB; \
   4.214 -                RETRIEVE_RGB_PIXEL((Uint8 *)srcp, srcbpp, pixel); \
   4.215 -                if ( pixel != ckey ) { \
   4.216 -                    RGB_FROM_PIXEL(pixel, srcfmt, sR, sG, sB); \
   4.217 +                RETRIEVE_RGB_PIXEL((Uint8 *)srcp, srcbpp, Pixel); \
   4.218 +                if ( Pixel != ckey ) { \
   4.219 +                    RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB); \
   4.220                      ASSEMBLE_RGBA((Uint8 *)dstp, dstbpp, dstfmt, \
   4.221                                sR, sG, sB, alpha); \
   4.222                  } \
   4.223 -                ((Uint8 *)dstp) += dstbpp; \
   4.224 -                ((Uint8 *)srcp) += srcbpp; \
   4.225 +                dstp = (Uint32 *) (((Uint8 *)dstp) + dstbpp); \
   4.226 +                srcp = (Uint32 *) (((Uint8 *)srcp) + srcbpp); \
   4.227                  widthvar--; \
   4.228              } \
   4.229          }
   4.230 @@ -819,6 +833,7 @@
   4.231                  /* Feature 2 is has-AltiVec */
   4.232                  | ((SDL_HasAltiVec()) ? 2 : 0)
   4.233                  /* Feature 4 is dont-use-prefetch */
   4.234 +                /* !!!! FIXME: Check for G5 or later, not the cache size! Always prefetch on a G4. */
   4.235                  | ((GetL3CacheSize() == 0) ? 4 : 0)
   4.236              );
   4.237          }
   4.238 @@ -911,43 +926,43 @@
   4.239  			dst += dstskip;
   4.240  		}
   4.241  	} else {
   4.242 -		int pixel;
   4.243 +		int Pixel;
   4.244  
   4.245  		while ( height-- ) {
   4.246  #ifdef USE_DUFFS_LOOP
   4.247  			DUFFS_LOOP(
   4.248 -				RGB888_RGB332(pixel, *src);
   4.249 -				*dst++ = map[pixel];
   4.250 +				RGB888_RGB332(Pixel, *src);
   4.251 +				*dst++ = map[Pixel];
   4.252  				++src;
   4.253  			, width);
   4.254  #else
   4.255  			for ( c=width/4; c; --c ) {
   4.256  				/* Pack RGB into 8bit pixel */
   4.257 -				RGB888_RGB332(pixel, *src);
   4.258 -				*dst++ = map[pixel];
   4.259 +				RGB888_RGB332(Pixel, *src);
   4.260 +				*dst++ = map[Pixel];
   4.261  				++src;
   4.262 -				RGB888_RGB332(pixel, *src);
   4.263 -				*dst++ = map[pixel];
   4.264 +				RGB888_RGB332(Pixel, *src);
   4.265 +				*dst++ = map[Pixel];
   4.266  				++src;
   4.267 -				RGB888_RGB332(pixel, *src);
   4.268 -				*dst++ = map[pixel];
   4.269 +				RGB888_RGB332(Pixel, *src);
   4.270 +				*dst++ = map[Pixel];
   4.271  				++src;
   4.272 -				RGB888_RGB332(pixel, *src);
   4.273 -				*dst++ = map[pixel];
   4.274 +				RGB888_RGB332(Pixel, *src);
   4.275 +				*dst++ = map[Pixel];
   4.276  				++src;
   4.277  			}
   4.278  			switch ( width & 3 ) {
   4.279  				case 3:
   4.280 -					RGB888_RGB332(pixel, *src);
   4.281 -					*dst++ = map[pixel];
   4.282 +					RGB888_RGB332(Pixel, *src);
   4.283 +					*dst++ = map[Pixel];
   4.284  					++src;
   4.285  				case 2:
   4.286 -					RGB888_RGB332(pixel, *src);
   4.287 -					*dst++ = map[pixel];
   4.288 +					RGB888_RGB332(Pixel, *src);
   4.289 +					*dst++ = map[Pixel];
   4.290  					++src;
   4.291  				case 1:
   4.292 -					RGB888_RGB332(pixel, *src);
   4.293 -					*dst++ = map[pixel];
   4.294 +					RGB888_RGB332(Pixel, *src);
   4.295 +					*dst++ = map[Pixel];
   4.296  					++src;
   4.297  			}
   4.298  #endif /* USE_DUFFS_LOOP */
   4.299 @@ -1820,7 +1835,7 @@
   4.300  #ifndef USE_DUFFS_LOOP
   4.301  	int c;
   4.302  #endif
   4.303 -	int pixel;
   4.304 +	int Pixel;
   4.305  	int width, height;
   4.306  	Uint32 *src;
   4.307  	const Uint8 *map;
   4.308 @@ -1839,8 +1854,8 @@
   4.309  #ifdef USE_DUFFS_LOOP
   4.310  	while ( height-- ) {
   4.311  		DUFFS_LOOP(
   4.312 -			RGB888_RGB332(pixel, *src);
   4.313 -			*dst++ = map[pixel];
   4.314 +			RGB888_RGB332(Pixel, *src);
   4.315 +			*dst++ = map[Pixel];
   4.316  			++src;
   4.317  		, width);
   4.318  		src += srcskip;
   4.319 @@ -1850,31 +1865,31 @@
   4.320  	while ( height-- ) {
   4.321  		for ( c=width/4; c; --c ) {
   4.322  			/* Pack RGB into 8bit pixel */
   4.323 -			RGB888_RGB332(pixel, *src);
   4.324 -			*dst++ = map[pixel];
   4.325 +			RGB888_RGB332(Pixel, *src);
   4.326 +			*dst++ = map[Pixel];
   4.327  			++src;
   4.328 -			RGB888_RGB332(pixel, *src);
   4.329 -			*dst++ = map[pixel];
   4.330 +			RGB888_RGB332(Pixel, *src);
   4.331 +			*dst++ = map[Pixel];
   4.332  			++src;
   4.333 -			RGB888_RGB332(pixel, *src);
   4.334 -			*dst++ = map[pixel];
   4.335 +			RGB888_RGB332(Pixel, *src);
   4.336 +			*dst++ = map[Pixel];
   4.337  			++src;
   4.338 -			RGB888_RGB332(pixel, *src);
   4.339 -			*dst++ = map[pixel];
   4.340 +			RGB888_RGB332(Pixel, *src);
   4.341 +			*dst++ = map[Pixel];
   4.342  			++src;
   4.343  		}
   4.344  		switch ( width & 3 ) {
   4.345  			case 3:
   4.346 -				RGB888_RGB332(pixel, *src);
   4.347 -				*dst++ = map[pixel];
   4.348 +				RGB888_RGB332(Pixel, *src);
   4.349 +				*dst++ = map[Pixel];
   4.350  				++src;
   4.351  			case 2:
   4.352 -				RGB888_RGB332(pixel, *src);
   4.353 -				*dst++ = map[pixel];
   4.354 +				RGB888_RGB332(Pixel, *src);
   4.355 +				*dst++ = map[Pixel];
   4.356  				++src;
   4.357  			case 1:
   4.358 -				RGB888_RGB332(pixel, *src);
   4.359 -				*dst++ = map[pixel];
   4.360 +				RGB888_RGB332(Pixel, *src);
   4.361 +				*dst++ = map[Pixel];
   4.362  				++src;
   4.363  		}
   4.364  		src += srcskip;
   4.365 @@ -1893,7 +1908,7 @@
   4.366  	Uint8 *dst;
   4.367  	int srcskip, dstskip;
   4.368  	int srcbpp;
   4.369 -	Uint32 pixel;
   4.370 +	Uint32 Pixel;
   4.371  	int  sR, sG, sB;
   4.372  	SDL_PixelFormat *srcfmt;
   4.373  
   4.374 @@ -1912,7 +1927,7 @@
   4.375  		while ( height-- ) {
   4.376  #ifdef USE_DUFFS_LOOP
   4.377  			DUFFS_LOOP(
   4.378 -				DISEMBLE_RGB(src, srcbpp, srcfmt, pixel,
   4.379 +				DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
   4.380  								sR, sG, sB);
   4.381  				if ( 1 ) {
   4.382  				  	/* Pack RGB into 8bit pixel */
   4.383 @@ -1925,7 +1940,7 @@
   4.384  			, width);
   4.385  #else
   4.386  			for ( c=width; c; --c ) {
   4.387 -				DISEMBLE_RGB(src, srcbpp, srcfmt, pixel,
   4.388 +				DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
   4.389  								sR, sG, sB);
   4.390  				if ( 1 ) {
   4.391  				  	/* Pack RGB into 8bit pixel */
   4.392 @@ -1944,7 +1959,7 @@
   4.393  		while ( height-- ) {
   4.394  #ifdef USE_DUFFS_LOOP
   4.395  			DUFFS_LOOP(
   4.396 -				DISEMBLE_RGB(src, srcbpp, srcfmt, pixel,
   4.397 +				DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
   4.398  								sR, sG, sB);
   4.399  				if ( 1 ) {
   4.400  				  	/* Pack RGB into 8bit pixel */
   4.401 @@ -1957,7 +1972,7 @@
   4.402  			, width);
   4.403  #else
   4.404  			for ( c=width; c; --c ) {
   4.405 -				DISEMBLE_RGB(src, srcbpp, srcfmt, pixel,
   4.406 +				DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
   4.407  								sR, sG, sB);
   4.408  				if ( 1 ) {
   4.409  				  	/* Pack RGB into 8bit pixel */
   4.410 @@ -1991,11 +2006,11 @@
   4.411  	while ( height-- ) {
   4.412  		DUFFS_LOOP(
   4.413  		{
   4.414 -		        Uint32 pixel;
   4.415 +		        Uint32 Pixel;
   4.416  			unsigned sR;
   4.417  			unsigned sG;
   4.418  			unsigned sB;
   4.419 -			DISEMBLE_RGB(src, srcbpp, srcfmt, pixel, sR, sG, sB);
   4.420 +			DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
   4.421  			ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha);
   4.422  			dst += dstbpp;
   4.423  			src += srcbpp;
   4.424 @@ -2023,9 +2038,9 @@
   4.425  	/* FIXME: should map alpha to [0..255] correctly! */
   4.426  	while ( height-- ) {
   4.427  		for ( c=width; c; --c ) {
   4.428 -		        Uint32 pixel;
   4.429 +		        Uint32 Pixel;
   4.430  			unsigned sR, sG, sB, sA;
   4.431 -			DISEMBLE_RGBA(src, srcbpp, srcfmt, pixel,
   4.432 +			DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel,
   4.433  				      sR, sG, sB, sA);
   4.434  			ASSEMBLE_RGBA(dst, dstbpp, dstfmt,
   4.435  				      sR, sG, sB, sA);
   4.436 @@ -2050,7 +2065,7 @@
   4.437  	Uint32 ckey = srcfmt->colorkey;
   4.438  	Uint32 rgbmask = ~srcfmt->Amask;
   4.439  	int srcbpp;
   4.440 -	Uint32 pixel;
   4.441 +	Uint32 Pixel;
   4.442  	Uint8  sR, sG, sB;
   4.443  
   4.444  	/* Set up some basic variables */
   4.445 @@ -2061,9 +2076,9 @@
   4.446  		while ( height-- ) {
   4.447  			DUFFS_LOOP(
   4.448  			{
   4.449 -				DISEMBLE_RGB(src, srcbpp, srcfmt, pixel,
   4.450 +				DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
   4.451  								sR, sG, sB);
   4.452 -				if ( (pixel & rgbmask) != ckey ) {
   4.453 +				if ( (Pixel & rgbmask) != ckey ) {
   4.454  				  	/* Pack RGB into 8bit pixel */
   4.455  				  	*dst = ((sR>>5)<<(3+2))|
   4.456  						((sG>>5)<<(2)) |
   4.457 @@ -2080,9 +2095,9 @@
   4.458  		while ( height-- ) {
   4.459  			DUFFS_LOOP(
   4.460  			{
   4.461 -				DISEMBLE_RGB(src, srcbpp, srcfmt, pixel,
   4.462 +				DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
   4.463  								sR, sG, sB);
   4.464 -				if ( (pixel & rgbmask) != ckey ) {
   4.465 +				if ( (Pixel & rgbmask) != ckey ) {
   4.466  				  	/* Pack RGB into 8bit pixel */
   4.467  				  	*dst = palmap[((sR>>5)<<(3+2))|
   4.468  							((sG>>5)<<(2))  |
   4.469 @@ -2147,13 +2162,13 @@
   4.470  	while ( height-- ) {
   4.471  		DUFFS_LOOP(
   4.472  		{
   4.473 -		        Uint32 pixel;
   4.474 +		        Uint32 Pixel;
   4.475  			unsigned sR;
   4.476  			unsigned sG;
   4.477  			unsigned sB;
   4.478 -			RETRIEVE_RGB_PIXEL(src, srcbpp, pixel);
   4.479 -			if ( pixel != ckey ) {
   4.480 -			        RGB_FROM_PIXEL(pixel, srcfmt, sR, sG, sB);
   4.481 +			RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel);
   4.482 +			if ( Pixel != ckey ) {
   4.483 +			        RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB);
   4.484  				ASSEMBLE_RGBA(dst, dstbpp, dstfmt,
   4.485  					      sR, sG, sB, alpha);
   4.486  			}
   4.487 @@ -2181,7 +2196,7 @@
   4.488  
   4.489  	Uint8 srcbpp;
   4.490  	Uint8 dstbpp;
   4.491 -	Uint32 pixel;
   4.492 +	Uint32 Pixel;
   4.493  	Uint8  sR, sG, sB, sA;
   4.494  
   4.495  	/* Set up some basic variables */
   4.496 @@ -2193,9 +2208,9 @@
   4.497  	while ( height-- ) {
   4.498  		DUFFS_LOOP(
   4.499  		{
   4.500 -			DISEMBLE_RGBA(src, srcbpp, srcfmt, pixel,
   4.501 +			DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel,
   4.502  				      sR, sG, sB, sA);
   4.503 -			if ( (pixel & rgbmask) != ckey ) {
   4.504 +			if ( (Pixel & rgbmask) != ckey ) {
   4.505  				  ASSEMBLE_RGBA(dst, dstbpp, dstfmt,
   4.506  						sR, sG, sB, sA);
   4.507  			}