-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathft_memmove.c
More file actions
31 lines (28 loc) · 1.15 KB
/
ft_memmove.c
File metadata and controls
31 lines (28 loc) · 1.15 KB
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
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: wbeets <wbeets@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/03/20 11:56:57 by wbeets #+# #+# */
/* Updated: 2015/03/20 11:56:57 by wbeets ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memmove(void *s1, const void *s2, size_t n)
{
size_t i;
if (!((int *)s1 > (int *)s2 && (int *)s2 + n > (int *)s1))
ft_memcpy(s1, s2, n);
else
{
i = n;
while (i > 0)
{
i--;
*((char *)s1 + i) = *((char *)s2 + i);
}
}
return (s1);
}