This repository was archived by the owner on Feb 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathft_memmove.c
More file actions
35 lines (32 loc) · 1.25 KB
/
ft_memmove.c
File metadata and controls
35 lines (32 loc) · 1.25 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dground <dground@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/05 20:27:03 by dground #+# #+# */
/* Updated: 2021/10/07 21:58:48 by dground ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memmove(void *dst, const void *src, size_t len)
{
unsigned char *tmp;
tmp = (unsigned char *)dst;
if (dst != 0 || src != 0)
{
if (src < dst)
{
while (len--)
*((unsigned char *)(dst + len)) = *((unsigned char *)(src
+ len));
}
else
{
while (len--)
*(unsigned char *)dst++ = *(unsigned char *)src++;
}
}
return (tmp);
}