-
Notifications
You must be signed in to change notification settings - Fork 4
/
ft_memmove.c
27 lines (25 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
26
27
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aalvarez <aalvarez@student.42urduliz.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/19 13:28:08 by aalvarez #+# #+# */
/* Updated: 2024/06/26 00:32:46 by aalvarez ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memmove(void *dst, const void *src, size_t n)
{
if (dst == src)
return (dst);
if (dst < src || dst >= src + n)
ft_memcpy(dst, src, n);
else
{
while (n--)
((unsigned char *)dst)[n] = ((unsigned char *)src)[n];
}
return (dst);
}