comparison include/SDL_stdinc.h @ 2111:874162355be5

Merged r3037:3038 from branches/SDL-1.2: Mac OS X memcpy/memset selection.
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 03 Jun 2007 08:39:23 +0000
parents 8bfba7ec379a
children 0313af081a84
comparison
equal deleted inserted replaced
2110:21942f552734 2111:874162355be5
277 extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len); 277 extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len);
278 #endif 278 #endif
279 #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) 279 #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
280 #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) 280 #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
281 281
282 #if defined(__GNUC__) && defined(i386) 282 /* We can count on memset existing on Mac OS X and being well-tuned. */
283 #if defined(__MACH__) && defined(__APPLE__)
284 #define SDL_memset4(dst, val, len) memset(dst, val, (len)*4)
285 #elif defined(__GNUC__) && defined(i386)
283 #define SDL_memset4(dst, val, len) \ 286 #define SDL_memset4(dst, val, len) \
284 do { \ 287 do { \
285 int u0, u1, u2; \ 288 int u0, u1, u2; \
286 __asm__ __volatile__ ( \ 289 __asm__ __volatile__ ( \
287 "cld\n\t" \ 290 "cld\n\t" \
306 } while ( --_n ); \ 309 } while ( --_n ); \
307 } \ 310 } \
308 } while(0) 311 } while(0)
309 #endif 312 #endif
310 313
311 #if defined(__GNUC__) && defined(i386) 314 /* We can count on memcpy existing on Mac OS X and being well-tuned. */
315 #if defined(__MACH__) && defined(__APPLE__)
316 #define SDL_memcpy(dst, src, len) memcpy(dst, src, len)
317 #elif defined(__GNUC__) && defined(i386)
312 #define SDL_memcpy(dst, src, len) \ 318 #define SDL_memcpy(dst, src, len) \
313 do { \ 319 do { \
314 int u0, u1, u2; \ 320 int u0, u1, u2; \
315 __asm__ __volatile__ ( \ 321 __asm__ __volatile__ ( \
316 "cld\n\t" \ 322 "cld\n\t" \
336 extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, 342 extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src,
337 size_t len); 343 size_t len);
338 #endif 344 #endif
339 #endif 345 #endif
340 346
341 #if defined(__GNUC__) && defined(i386) 347 /* We can count on memcpy existing on Mac OS X and being well-tuned. */
348 #if defined(__MACH__) && defined(__APPLE__)
349 #define SDL_memcpy4(dst, src, len) memcpy(dst, src, (len)*4)
350 #elif defined(__GNUC__) && defined(i386)
342 #define SDL_memcpy4(dst, src, len) \ 351 #define SDL_memcpy4(dst, src, len) \
343 do { \ 352 do { \
344 int ecx, edi, esi; \ 353 int ecx, edi, esi; \
345 __asm__ __volatile__ ( \ 354 __asm__ __volatile__ ( \
346 "cld\n\t" \ 355 "cld\n\t" \