Take care of one BSOD in NtGdiDdCreateDirectDrawObject, it is not correct fix, it...
[reactos.git] / rosapps / mc / slang / slmemcpy.c
1 /* Copyright (c) 1992, 1995 John E. Davis
2 * All rights reserved.
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Perl Artistic License.
6 */
7
8
9 /* These routines are fast memcpy, memset routines. When available, I
10 use system rouines. For msdos, I use inline assembly. */
11
12 /* The current versions only work in the forward direction only!! */
13
14 #include "config.h"
15
16 #include <stdio.h>
17 #include "slang.h"
18 #include "_slang.h"
19
20 char *SLmemcpy(char *s1, char *s2, int n)
21 {
22 #if defined(msdos) && !defined(__WIN32__) && !defined(__GO32__)
23 asm mov ax, ds
24 asm mov bx, si
25 asm mov dx, di
26 asm mov cx, n
27 asm les di, s1
28 asm lds si, s2
29 asm cld
30 asm rep movsb
31 asm mov ds, ax
32 asm mov si, bx
33 asm mov di, dx
34 return(s1);
35
36 #else
37 register char *smax, *s = s1;
38 int n2;
39
40 n2 = n % 4;
41 smax = s + (n - 4);
42 while (s <= smax)
43 {
44 *s = *s2; *(s + 1) = *(s2 + 1); *(s + 2) = *(s2 + 2); *(s + 3) = *(s2 + 3);
45 s += 4;
46 s2 += 4;
47 }
48 while (n2--) *s++ = *s2++;
49 return(s1);
50 #endif
51 }