-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memmove.c
25 lines (23 loc) · 1.14 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rodrodri <[email protected] > +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/30 14:41:03 by rodrodri #+# #+# */
/* Updated: 2021/11/14 21:32:39 by rodrodri ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memmove(void *dst, const void *src, size_t len)
{
if (len && (!dst && !src))
return (NULL);
if ((char *)src > (char *)dst)
ft_memcpy(dst, src, len);
else
while (len--)
*(char *)(dst + len) = *(char *)(src + len);
return (dst);
}