-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memmove.c
29 lines (26 loc) · 1.28 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
28
29
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_memmove.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: davfelix <[email protected]> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2018/10/12 14:10:26 by davfelix #+# ## ## #+# */
/* Updated: 2018/10/12 20:39:55 by davfelix ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include "libft.h"
void *ft_memmove(void *dst, const void *src, size_t len)
{
unsigned const char *tmp_src;
unsigned char *tmp_dst;
tmp_src = (unsigned const char *)src;
tmp_dst = (unsigned char *)dst;
if (src > dst)
ft_memcpy(dst, src, len);
else
while (len-- > 0)
*(tmp_dst + len) = *(tmp_src + len);
return (dst);
}