comparison include/SDL_stdinc.h @ 4283:cd511a8560b7 SDL-1.2

Ozkan Sezer 2009-04-01 23:17:13 PDT This change should be applied to the 1.2 branch, too, because the svn version SDL_net requires it.
author Sam Lantinga <slouken@libsdl.org>
date Thu, 08 Oct 2009 07:45:55 +0000
parents 48e63c07bbbf
children 9f66052ebb81
comparison
equal deleted inserted replaced
4282:4909c960832e 4283:cd511a8560b7
264 int u0, u1, u2; \ 264 int u0, u1, u2; \
265 __asm__ __volatile__ ( \ 265 __asm__ __volatile__ ( \
266 "cld\n\t" \ 266 "cld\n\t" \
267 "rep ; stosl\n\t" \ 267 "rep ; stosl\n\t" \
268 : "=&D" (u0), "=&a" (u1), "=&c" (u2) \ 268 : "=&D" (u0), "=&a" (u1), "=&c" (u2) \
269 : "0" (dst), "1" (val), "2" ((Uint32)(len)) \ 269 : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len)) \
270 : "memory" ); \ 270 : "memory" ); \
271 } while(0) 271 } while(0)
272 #endif 272 #endif
273 #ifndef SDL_memset4 273 #ifndef SDL_memset4
274 #define SDL_memset4(dst, val, len) \ 274 #define SDL_memset4(dst, val, len) \
275 do { \ 275 do { \
276 unsigned _count = (len); \ 276 unsigned _count = (len); \
277 unsigned _n = (_count + 3) / 4; \ 277 unsigned _n = (_count + 3) / 4; \
278 Uint32 *_p = (Uint32 *)(dst); \ 278 Uint32 *_p = SDL_static_cast(Uint32 *, dst); \
279 Uint32 _val = (val); \ 279 Uint32 _val = (val); \
280 if (len == 0) break; \ 280 if (len == 0) break; \
281 switch (_count % 4) { \ 281 switch (_count % 4) { \
282 case 0: do { *_p++ = _val; \ 282 case 0: do { *_p++ = _val; \
283 case 3: *_p++ = _val; \ 283 case 3: *_p++ = _val; \
304 "1:\ttestb $1,%b4\n\t" \ 304 "1:\ttestb $1,%b4\n\t" \
305 "je 2f\n\t" \ 305 "je 2f\n\t" \
306 "movsb\n" \ 306 "movsb\n" \
307 "2:" \ 307 "2:" \
308 : "=&c" (u0), "=&D" (u1), "=&S" (u2) \ 308 : "=&c" (u0), "=&D" (u1), "=&S" (u2) \
309 : "0" ((unsigned)(len)/4), "q" (len), "1" (dst),"2" (src) \ 309 : "0" (SDL_static_cast(unsigned, len)/4), "q" (len), "1" (dst),"2" (src) \
310 : "memory" ); \ 310 : "memory" ); \
311 } while(0) 311 } while(0)
312 #endif 312 #endif
313 #ifndef SDL_memcpy 313 #ifndef SDL_memcpy
314 #ifdef HAVE_MEMCPY 314 #ifdef HAVE_MEMCPY
329 int ecx, edi, esi; \ 329 int ecx, edi, esi; \
330 __asm__ __volatile__ ( \ 330 __asm__ __volatile__ ( \
331 "cld\n\t" \ 331 "cld\n\t" \
332 "rep ; movsl" \ 332 "rep ; movsl" \
333 : "=&c" (ecx), "=&D" (edi), "=&S" (esi) \ 333 : "=&c" (ecx), "=&D" (edi), "=&S" (esi) \
334 : "0" ((unsigned)(len)), "1" (dst), "2" (src) \ 334 : "0" (SDL_static_cast(unsigned, len)), "1" (dst), "2" (src) \
335 : "memory" ); \ 335 : "memory" ); \
336 } while(0) 336 } while(0)
337 #endif 337 #endif
338 #ifndef SDL_memcpy4 338 #ifndef SDL_memcpy4
339 #define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2) 339 #define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2)
341 341
342 #if defined(__GNUC__) && defined(i386) 342 #if defined(__GNUC__) && defined(i386)
343 #define SDL_revcpy(dst, src, len) \ 343 #define SDL_revcpy(dst, src, len) \
344 do { \ 344 do { \
345 int u0, u1, u2; \ 345 int u0, u1, u2; \
346 char *dstp = (char *)(dst); \ 346 char *dstp = SDL_static_cast(char *, dst); \
347 char *srcp = (char *)(src); \ 347 char *srcp = SDL_static_cast(char *, src); \
348 int n = (len); \ 348 int n = (len); \
349 if ( n >= 4 ) { \ 349 if ( n >= 4 ) { \
350 __asm__ __volatile__ ( \ 350 __asm__ __volatile__ ( \
351 "std\n\t" \ 351 "std\n\t" \
352 "rep ; movsl\n\t" \ 352 "rep ; movsl\n\t" \