-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memmove.c
30 lines (27 loc) · 1.18 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bcaffere <[email protected] +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/04/24 15:50:55 by bcaffere #+# #+# */
/* Updated: 2021/05/01 20:20:30 by bcaffere ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memmove(void *dest, void *src, size_t len)
{
t_uch *u_dest;
t_uch *u_src;
if (dest == src || len == 0)
return (dest);
u_dest = (t_uch *)dest;
u_src = (t_uch *)src;
if (dest < src)
ft_memcpy(dest, src, len);
else
while (len--)
u_dest[len] = u_src[len];
return (dest);
}