Release 970329
[wine/multimedia.git] / misc / port.c
blobb16ff0f8873e8671dd0c22da1d44dc68f17a3a19
1 /*
2 * Misc. functions for systems that don't have them
4 * Copyright 1996 Alexandre Julliard
5 */
7 #include "config.h"
8 #include <sys/types.h>
9 #include <sys/time.h>
11 #ifndef HAVE_USLEEP
12 #ifdef __EMX__
13 unsigned int usleep (unsigned int useconds) { DosSleep(useconds); }
14 #else
15 unsigned int usleep (unsigned int useconds)
17 struct timeval delay;
19 delay.tv_sec = 0;
20 delay.tv_usec = useconds;
22 select( 0, 0, 0, 0, &delay );
23 return 0;
25 #endif
26 #endif /* HAVE_USLEEP */
28 #ifndef HAVE_MEMMOVE
29 void *memmove( void *dest, const void *src, unsigned int len )
31 register char *dst = dest;
33 /* Use memcpy if not overlapping */
34 if ((dst + len <= (char *)src) || ((char *)src + len <= dst))
36 memcpy( dst, src, len );
38 /* Otherwise do it the hard way (FIXME: could do better than this) */
39 else if (dst < src)
41 while (len--) *dst++ = *((char *)src)++;
43 else
45 dst += len - 1;
46 src = (char *)src + len - 1;
47 while (len--) *dst-- = *((char *)src)--;
49 return dest;
51 #endif /* HAVE_MEMMOVE */