-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_memmove.c
executable file
·29 lines (26 loc) · 1.16 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rel-fila <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/08 18:22:58 by rel-fila #+# #+# */
/* Updated: 2022/10/18 22:01:09 by rel-fila ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memmove(void *dst, const void *src, size_t len)
{
char *ds;
char *sr;
ds = (char *) dst;
sr = (char *) src;
if (dst == NULL && src == NULL)
return (NULL);
if (ds < sr)
return (ft_memcpy(ds, sr, len));
while (len--)
ds[len] = sr[len];
return (ds);
}