-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memmove.c
More file actions
executable file
·33 lines (30 loc) · 1.16 KB
/
ft_memmove.c
File metadata and controls
executable file
·33 lines (30 loc) · 1.16 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
32
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: luperez <luperez@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/05 19:36:20 by luperez #+# #+# */
/* Updated: 2014/11/06 23:06:31 by luperez ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memmove(void *dst, const void *src, size_t n)
{
char *dst2;
char *src2;
dst2 = (char *)dst;
src2 = (char *)src;
if (src2 < dst2)
{
dst2 += n;
src2 += n;
while (n--)
*--dst2 = *--src2;
}
else
while (n--)
*dst2++ = *src2++;
return (dst);
}