Revision 17620,
634 bytes
checked in by ghudson, 22 years ago
(diff) |
This commit was generated by cvs2svn to compensate for changes in r17619,
which included commits to RCS files with non-trunk default branches.
|
Line | |
---|
1 | /* memmove.c -- copy memory. |
---|
2 | Copy LENGTH bytes from SOURCE to DEST. Does not null-terminate. |
---|
3 | In the public domain. |
---|
4 | By David MacKenzie <djm@gnu.ai.mit.edu>. */ |
---|
5 | |
---|
6 | #ifdef HAVE_CONFIG_H |
---|
7 | #include <config.h> |
---|
8 | #endif |
---|
9 | |
---|
10 | void |
---|
11 | memmove (dest, source, length) |
---|
12 | char *dest; |
---|
13 | const char *source; |
---|
14 | unsigned length; |
---|
15 | { |
---|
16 | if (source < dest) |
---|
17 | /* Moving from low mem to hi mem; start at end. */ |
---|
18 | for (source += length, dest += length; length; --length) |
---|
19 | *--dest = *--source; |
---|
20 | else if (source != dest) |
---|
21 | /* Moving from hi mem to low mem; start at beginning. */ |
---|
22 | for (; length; --length) |
---|
23 | *dest++ = *source++; |
---|
24 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.