-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memmove.c
27 lines (25 loc) · 1.15 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: mesafi <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/30 22:17:41 by mesafi #+# #+# */
/* Updated: 2020/01/20 13:29:54 by mesafi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdlib.h>
void *ft_memmove(void *dest, const void *src, size_t n)
{
if (src - dest > 0)
ft_memcpy(dest, src, n);
else if (src - dest < 0)
while (n)
{
*(unsigned char *)(dest + n - 1) = *(unsigned char *)(src + n - 1);
n--;
}
return (dest);
}