repo.or.cz
/
ruby.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
[DOC] Tweaks to Array#combination (#11440)
[ruby.git]
/
missing
/
memmove.c
blob
e8e17e87e7231cbec36690bde42c5762571a8cb0
1
/* public domain rewrite of memcmp(3) */
2
3
#include
"ruby/missing.h"
4
#include <stddef.h>
5
6
void
*
7
memmove
(
void
*
d
,
const void
*
s
,
size_t
n
)
8
{
9
char
*
dst
= (
char
*)
d
;
10
const char
*
src
= (
const char
*)
s
;
11
12
if
(
src
<
dst
) {
13
src
+=
n
;
14
dst
+=
n
;
15
for
(;
n
; --
n
)
16
*--
dst
= *--
src
;
17
}
18
else if
(
dst
<
src
)
19
for
(;
n
; --
n
)
20
*
dst
++ = *
src
++;
21
return
d
;
22
}