/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memcmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/03 14:57:30 by jhalford #+# #+# */ /* Updated: 2016/11/03 15:44:21 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" int ft_memcmp(const void *s1, const void *s2, size_t n) { size_t i; int cmp; i = -1; while (++i < n) { cmp = *(unsigned char *)s1++ - *(unsigned char *)s2++; if (cmp) return (cmp); } return (cmp); }