/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memcmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: nalebrun +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/14 11:54:32 by nalebrun #+# #+# */ /* Updated: 2024/11/25 16:15:04 by nalebrun ### ########.fr */ /* */ /* ************************************************************************** */ #include "../../libft.h" int ft_memcmp(const void *s1, const void *s2, size_t n) { size_t i; const unsigned char *ps1; const unsigned char *ps2; ps1 = (const unsigned char *)s1; ps2 = (const unsigned char *)s2; i = -1; while (++i < n) if (ps1[i] != ps2[i]) return (ps1[i] - ps2[i]); return (0); }