-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memmove.c
38 lines (35 loc) · 1.24 KB
/
ft_memmove.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: wboutzou <wboutzou@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/24 18:05:19 by wboutzou #+# #+# */
/* Updated: 2021/11/24 18:05:20 by wboutzou ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memmove(void *dest, const void *src, size_t count)
{
size_t i;
unsigned char *p;
unsigned char *s;
p = (unsigned char *)dest;
s = (unsigned char *)src;
i = 0;
if (!dest && !src)
return (0);
if (src > dest)
{
ft_memcpy(dest, src, count);
}
else
{
while (count--)
{
*(p + count) = *(s + count);
}
}
return ((void *) dest);
}