diff options
Diffstat (limited to 'firmware/asm/mempcpy.c')
-rw-r--r-- | firmware/asm/mempcpy.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/firmware/asm/mempcpy.c b/firmware/asm/mempcpy.c new file mode 100644 index 0000000000..2b1ccecbe8 --- /dev/null +++ b/firmware/asm/mempcpy.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | FUNCTION | ||
3 | <<mempcpy>>---copy memory regions and return end pointer | ||
4 | |||
5 | ANSI_SYNOPSIS | ||
6 | #include <string.h> | ||
7 | void* mempcpy(void *<[out]>, const void *<[in]>, size_t <[n]>); | ||
8 | |||
9 | TRAD_SYNOPSIS | ||
10 | void *mempcpy(<[out]>, <[in]>, <[n]> | ||
11 | void *<[out]>; | ||
12 | void *<[in]>; | ||
13 | size_t <[n]>; | ||
14 | |||
15 | DESCRIPTION | ||
16 | This function copies <[n]> bytes from the memory region | ||
17 | pointed to by <[in]> to the memory region pointed to by | ||
18 | <[out]>. | ||
19 | |||
20 | If the regions overlap, the behavior is undefined. | ||
21 | |||
22 | RETURNS | ||
23 | <<mempcpy>> returns a pointer to the byte following the | ||
24 | last byte copied to the <[out]> region. | ||
25 | |||
26 | PORTABILITY | ||
27 | <<mempcpy>> is a GNU extension. | ||
28 | |||
29 | <<mempcpy>> requires no supporting OS subroutines. | ||
30 | |||
31 | */ | ||
32 | |||
33 | #include "config.h" | ||
34 | #include "_ansi.h" /* for _DEFUN */ | ||
35 | #include <string.h> | ||
36 | |||
37 | /* This may be conjoined with memcpy in <cpu>/memcpy.S to get it nearly for | ||
38 | free */ | ||
39 | |||
40 | _PTR | ||
41 | _DEFUN (mempcpy, (dst0, src0, len0), | ||
42 | _PTR dst0 _AND | ||
43 | _CONST _PTR src0 _AND | ||
44 | size_t len0) | ||
45 | { | ||
46 | return memcpy(dst0, src0, len0) + len0; | ||
47 | } | ||