Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

memmove.c
Go to the documentation of this file.
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 }
memmove
void * memmove(void *d, const void *s, size_t n)
Definition: memmove.c:7
src
__inline__ const void *__restrict src
Definition: rb_mjit_min_header-2.7.0.h:2836
n
const char size_t n
Definition: rb_mjit_min_header-2.7.0.h:5456
missing.h