31 lines
1.2 KiB
C
31 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_memmove.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/11/03 14:57:34 by jhalford #+# #+# */
|
|
/* Updated: 2016/11/11 17:41:14 by jhalford ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
void *ft_memmove(void *dst, const void *src, size_t len)
|
|
{
|
|
char *srcc;
|
|
char *dstc;
|
|
size_t i;
|
|
|
|
i = -1;
|
|
srcc = (char *)src;
|
|
dstc = (char *)dst;
|
|
if (srcc < dstc)
|
|
while ((int)(--len) >= 0)
|
|
*(dstc + len) = *(srcc + len);
|
|
else
|
|
while (++i < len)
|
|
*(dstc + i) = *(srcc + i);
|
|
return (dst);
|
|
}
|