style: reoarginsed the file and fix the makefile
This commit is contained in:
parent
ecd9608320
commit
a5fe7484a1
46 changed files with 140 additions and 49 deletions
51
memory/ft_memmove.c
Normal file
51
memory/ft_memmove.c
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_memmove.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/07 16:51:35 by rparodi #+# #+# */
|
||||
/* Updated: 2023/11/13 19:55:40 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
char *ft_checks(char *s, char *d, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
i = 0;
|
||||
if (d < s)
|
||||
{
|
||||
while (i < n)
|
||||
{
|
||||
d[i] = s[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
i = n;
|
||||
while (i > 0)
|
||||
{
|
||||
i--;
|
||||
d[i] = s[i];
|
||||
}
|
||||
}
|
||||
return (d);
|
||||
}
|
||||
|
||||
void *ft_memmove(void *dest, const void *src, size_t n)
|
||||
{
|
||||
char *d;
|
||||
char *s;
|
||||
|
||||
if (!dest && !src)
|
||||
return (NULL);
|
||||
d = (char *)dest;
|
||||
s = (char *)src;
|
||||
ft_checks(s, d, n);
|
||||
return (dest);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue