42-archive/libftasm/srcs/mem/ft_memmove.c
2017-03-31 18:21:20 +02:00

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);
}