-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memmove.c
More file actions
41 lines (37 loc) · 1.26 KB
/
Copy pathft_memmove.c
File metadata and controls
41 lines (37 loc) · 1.26 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
34
35
36
37
38
39
40
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rahidalg <rahidalg@student.42madrid.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/11 18:26:22 by rahidalg #+# #+# */
/* Updated: 2024/04/18 14:39:53 by rahidalg ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memmove(void *dst, const void *src, size_t len)
{
size_t i;
while (dst == src || !len)
return (dst);
if (src < dst)
{
i = len;
while (i > 0)
{
i--;
*(unsigned char *)(dst + i) = *(unsigned char *)(src + i);
}
}
else
{
i = 0;
while (i < len)
{
*(unsigned char *)(dst + i) = *(unsigned char *)(src + i);
i++;
}
}
return (dst);
}