History

add hg and python

cinap_lenrek committed 15 years ago

Commit 4bb9e221 parent 987265c3706 files · +1228772 −-233Browse files

Showing the changes to sys/src/cmd/python/Python/memmove.c (1 of 3706 files). Show all

Unified · Split

sys/src/cmd/python/Python/memmove.c+25−0
@@ -0,0 +1,25 @@
1
2/* A perhaps slow but I hope correct implementation of memmove */
3
4extern char *memcpy(char *, char *, int);
5
6char *
7memmove(char *dst, char *src, int n)
8{
9 char *realdst = dst;
10 if (n <= 0)
11 return dst;
12 if (src >= dst+n || dst >= src+n)
13 return memcpy(dst, src, n);
14 if (src > dst) {
15 while (--n >= 0)
16 *dst++ = *src++;
17 }
18 else if (src < dst) {
19 src += n;
20 dst += n;
21 while (--n >= 0)
22 *--dst = *--src;
23 }
24 return realdst;
25}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t