From 579a26f5593039ffbbd1a81e45ecf0ef8797cb5d Mon Sep 17 00:00:00 2001 From: nass1pro Date: Tue, 9 Jun 2020 19:48:34 +0200 Subject: add lexer add single quote --- test_mini/libft/src/mem/ft_memcmp.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test_mini/libft/src/mem/ft_memcmp.c (limited to 'test_mini/libft/src/mem/ft_memcmp.c') diff --git a/test_mini/libft/src/mem/ft_memcmp.c b/test_mini/libft/src/mem/ft_memcmp.c new file mode 100644 index 0000000..233d796 --- /dev/null +++ b/test_mini/libft/src/mem/ft_memcmp.c @@ -0,0 +1,30 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_memcmp.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/10/07 09:56:44 by cacharle #+# #+# */ +/* Updated: 2020/01/17 10:54:15 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int ft_memcmp(const void *s1, const void *s2, size_t n) +{ + size_t i; + t_ftbyte *cast_s1; + t_ftbyte *cast_s2; + + cast_s1 = (t_ftbyte*)s1; + cast_s2 = (t_ftbyte*)s2; + if (n == 0) + return (0); + i = -1; + while (++i < n) + if (cast_s1[i] != cast_s2[i]) + return (cast_s1[i] - cast_s2[i]); + return (0); +} -- cgit