comparison src/video/SDL_blit_0.c @ 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 e8157fcb3114
comparison
equal deleted inserted replaced
90:ee1f71c10889 91:e85e03f195b4
53 53
54 if ( map ) { 54 if ( map ) {
55 while ( height-- ) { 55 while ( height-- ) {
56 Uint8 byte = 0, bit; 56 Uint8 byte = 0, bit;
57 for ( c=0; c<width; ++c ) { 57 for ( c=0; c<width; ++c ) {
58 if ( (c%8) == 0 ) { 58 if ( (c&7) == 0 ) {
59 byte = *src++; 59 byte = *src++;
60 } 60 }
61 bit = (byte&0x80)>>7; 61 bit = (byte&0x80)>>7;
62 if ( 1 ) { 62 if ( 1 ) {
63 *dst = map[bit]; 63 *dst = map[bit];
70 } 70 }
71 } else { 71 } else {
72 while ( height-- ) { 72 while ( height-- ) {
73 Uint8 byte = 0, bit; 73 Uint8 byte = 0, bit;
74 for ( c=0; c<width; ++c ) { 74 for ( c=0; c<width; ++c ) {
75 if ( (c%8) == 0 ) { 75 if ( (c&7) == 0 ) {
76 byte = *src++; 76 byte = *src++;
77 } 77 }
78 bit = (byte&0x80)>>7; 78 bit = (byte&0x80)>>7;
79 if ( 1 ) { 79 if ( 1 ) {
80 *dst = bit; 80 *dst = bit;
106 srcskip += width-(width+7)/8; 106 srcskip += width-(width+7)/8;
107 107
108 while ( height-- ) { 108 while ( height-- ) {
109 Uint8 byte = 0, bit; 109 Uint8 byte = 0, bit;
110 for ( c=0; c<width; ++c ) { 110 for ( c=0; c<width; ++c ) {
111 if ( (c%8) == 0 ) { 111 if ( (c&7) == 0 ) {
112 byte = *src++; 112 byte = *src++;
113 } 113 }
114 bit = (byte&0x80)>>7; 114 bit = (byte&0x80)>>7;
115 if ( 1 ) { 115 if ( 1 ) {
116 *dst = map[bit]; 116 *dst = map[bit];
140 srcskip += width-(width+7)/8; 140 srcskip += width-(width+7)/8;
141 141
142 while ( height-- ) { 142 while ( height-- ) {
143 Uint8 byte = 0, bit; 143 Uint8 byte = 0, bit;
144 for ( c=0; c<width; ++c ) { 144 for ( c=0; c<width; ++c ) {
145 if ( (c%8) == 0 ) { 145 if ( (c&7) == 0 ) {
146 byte = *src++; 146 byte = *src++;
147 } 147 }
148 bit = (byte&0x80)>>7; 148 bit = (byte&0x80)>>7;
149 if ( 1 ) { 149 if ( 1 ) {
150 o = bit * 4; 150 o = bit * 4;
178 srcskip += width-(width+7)/8; 178 srcskip += width-(width+7)/8;
179 179
180 while ( height-- ) { 180 while ( height-- ) {
181 Uint8 byte = 0, bit; 181 Uint8 byte = 0, bit;
182 for ( c=0; c<width; ++c ) { 182 for ( c=0; c<width; ++c ) {
183 if ( (c%8) == 0 ) { 183 if ( (c&7) == 0 ) {
184 byte = *src++; 184 byte = *src++;
185 } 185 }
186 bit = (byte&0x80)>>7; 186 bit = (byte&0x80)>>7;
187 if ( 1 ) { 187 if ( 1 ) {
188 *dst = map[bit]; 188 *dst = map[bit];
212 212
213 if ( palmap ) { 213 if ( palmap ) {
214 while ( height-- ) { 214 while ( height-- ) {
215 Uint8 byte = 0, bit; 215 Uint8 byte = 0, bit;
216 for ( c=0; c<width; ++c ) { 216 for ( c=0; c<width; ++c ) {
217 if ( (c%8) == 0 ) { 217 if ( (c&7) == 0 ) {
218 byte = *src++; 218 byte = *src++;
219 } 219 }
220 bit = (byte&0x80)>>7; 220 bit = (byte&0x80)>>7;
221 if ( bit != ckey ) { 221 if ( bit != ckey ) {
222 *dst = palmap[bit]; 222 *dst = palmap[bit];
229 } 229 }
230 } else { 230 } else {
231 while ( height-- ) { 231 while ( height-- ) {
232 Uint8 byte = 0, bit; 232 Uint8 byte = 0, bit;
233 for ( c=0; c<width; ++c ) { 233 for ( c=0; c<width; ++c ) {
234 if ( (c%8) == 0 ) { 234 if ( (c&7) == 0 ) {
235 byte = *src++; 235 byte = *src++;
236 } 236 }
237 bit = (byte&0x80)>>7; 237 bit = (byte&0x80)>>7;
238 if ( bit != ckey ) { 238 if ( bit != ckey ) {
239 *dst = bit; 239 *dst = bit;
264 dstskip /= 2; 264 dstskip /= 2;
265 265
266 while ( height-- ) { 266 while ( height-- ) {
267 Uint8 byte = 0, bit; 267 Uint8 byte = 0, bit;
268 for ( c=0; c<width; ++c ) { 268 for ( c=0; c<width; ++c ) {
269 if ( (c%8) == 0 ) { 269 if ( (c&7) == 0 ) {
270 byte = *src++; 270 byte = *src++;
271 } 271 }
272 bit = (byte&0x80)>>7; 272 bit = (byte&0x80)>>7;
273 if ( bit != ckey ) { 273 if ( bit != ckey ) {
274 *dstp=((Uint16 *)palmap)[bit]; 274 *dstp=((Uint16 *)palmap)[bit];
297 srcskip += width-(width+7)/8; 297 srcskip += width-(width+7)/8;
298 298
299 while ( height-- ) { 299 while ( height-- ) {
300 Uint8 byte = 0, bit; 300 Uint8 byte = 0, bit;
301 for ( c=0; c<width; ++c ) { 301 for ( c=0; c<width; ++c ) {
302 if ( (c%8) == 0 ) { 302 if ( (c&7) == 0 ) {
303 byte = *src++; 303 byte = *src++;
304 } 304 }
305 bit = (byte&0x80)>>7; 305 bit = (byte&0x80)>>7;
306 if ( bit != ckey ) { 306 if ( bit != ckey ) {
307 memcpy(dst, &palmap[bit*4], 3); 307 memcpy(dst, &palmap[bit*4], 3);
331 dstskip /= 4; 331 dstskip /= 4;
332 332
333 while ( height-- ) { 333 while ( height-- ) {
334 Uint8 byte = 0, bit; 334 Uint8 byte = 0, bit;
335 for ( c=0; c<width; ++c ) { 335 for ( c=0; c<width; ++c ) {
336 if ( (c%8) == 0 ) { 336 if ( (c&7) == 0 ) {
337 byte = *src++; 337 byte = *src++;
338 } 338 }
339 bit = (byte&0x80)>>7; 339 bit = (byte&0x80)>>7;
340 if ( bit != ckey ) { 340 if ( bit != ckey ) {
341 *dstp=((Uint32 *)palmap)[bit]; 341 *dstp=((Uint32 *)palmap)[bit];
367 srcskip += width-(width+7)/8; 367 srcskip += width-(width+7)/8;
368 368
369 while ( height-- ) { 369 while ( height-- ) {
370 Uint8 byte = 0, bit; 370 Uint8 byte = 0, bit;
371 for ( c=0; c<width; ++c ) { 371 for ( c=0; c<width; ++c ) {
372 if ( (c%8) == 0 ) { 372 if ( (c&7) == 0 ) {
373 byte = *src++; 373 byte = *src++;
374 } 374 }
375 bit = (byte&0x80)>>7; 375 bit = (byte&0x80)>>7;
376 if ( 1 ) { 376 if ( 1 ) {
377 Uint32 pixel; 377 Uint32 pixel;
414 srcskip += width-(width+7)/8; 414 srcskip += width-(width+7)/8;
415 415
416 while ( height-- ) { 416 while ( height-- ) {
417 Uint8 byte = 0, bit; 417 Uint8 byte = 0, bit;
418 for ( c=0; c<width; ++c ) { 418 for ( c=0; c<width; ++c ) {
419 if ( (c%8) == 0 ) { 419 if ( (c&7) == 0 ) {
420 byte = *src++; 420 byte = *src++;
421 } 421 }
422 bit = (byte&0x80)>>7; 422 bit = (byte&0x80)>>7;
423 if ( bit != ckey ) { 423 if ( bit != ckey ) {
424 int sR, sG, sB; 424 int sR, sG, sB;