-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathft_memmove.c
24 lines (22 loc) · 1.15 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ykoh <ykoh@student.42seoul.kr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/03/09 17:19:14 by ykoh #+# #+# */
/* Updated: 2020/04/10 22:30:28 by ykoh ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memmove(void *dst, const void *src, size_t len)
{
if (!dst && !src)
return (NULL);
if ((size_t)(dst - src) >= len)
return (ft_memcpy(dst, src, len));
while (len--)
*((unsigned char *)dst + len) = *((unsigned char *)src + len);
return (dst);
}