fractol/libft/src/ft_memcmp.c
2023-03-01 04:36:42 +01:00

32 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_memcmp.c :+: :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 08:41:32 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:39 by houtworm ### ########.fr */
/* */
/* ************************************************************************** */
#include "../libft.h"
int ft_memcmp(const void *s1, const void *s2, size_t n)
{
const unsigned char *p1;
const unsigned char *p2;
p1 = s1;
p2 = s2;
while (n)
{
if (*p1 != *p2)
return (*p1 - *p2);
p1++;
p2++;
n--;
}
return (0);
}