/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memcmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: tosuman +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/05/22 16:44:15 by tosuman #+# #+# */ /* Updated: 2023/06/02 20:03:03 by tischmid ### ########.fr */ /* */ /* ************************************************************************** */ #include int ft_memcmp(void const *s1, void const *s2, size_t n) { unsigned char *us1; unsigned char *us2; us1 = (unsigned char *) s1; us2 = (unsigned char *) s2; if (!n) return (0); while (n--) if (*us1++ != *us2++) return (*--us1 - *--us2); return (0); }