fuckinlem_in/libft/srcs/ft_strcmp.c
Tanguy MAZE 54be2278c0 It finnaly kinda works
algorithm with no double nodes and nearly efficient enough
still some optimizations to find for --big-superposition maps
2019-04-18 20:18:50 +02:00

29 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/03 15:38:27 by tmaze #+# #+# */
/* Updated: 2018/04/08 15:30:24 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_strcmp(const char *s1, const char *s2)
{
int i;
int diff;
i = 1;
diff = (unsigned char)s1[0] - (unsigned char)s2[0];
while (diff == 0 && s1[i - 1] && s2[i - 1])
{
diff = (unsigned char)s1[i] - (unsigned char)s2[i];
i++;
}
return (diff);
}