-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memcpy.c
42 lines (39 loc) · 1.32 KB
/
ft_memcpy.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
30
31
32
33
34
35
36
37
38
39
40
41
42
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yuske <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/31 01:27:26 by yuske #+# #+# */
/* Updated: 2023/04/03 23:31:37 by yuske ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
//15L
/**
* @brief
*
* @param dst
* @param src
* @param n
* @return void*
*/
void *ft_memcpy(void *dst, const void *src, size_t n_cpy)
{
size_t i;
unsigned char *dst_bin;
const unsigned char *src_bin;
if (dst == src)
return (NULL);
dst_bin = (unsigned char *)dst;
src_bin = (const unsigned char *)src;
i = 0;
while (i < n_cpy)
{
dst_bin[i] = src_bin[i];
i += 1;
}
return (dst_bin);
}
// if (!dst && !src)