ajout libft en dure

This commit is contained in:
hugodu69
2020-06-24 17:42:50 +02:00
parent a1b21caa35
commit dca24e1312
88 changed files with 5283 additions and 18 deletions

32
libft/srcs/ft_memcmp.c Normal file
View File

@@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/25 13:56:05 by hulamy #+# #+# */
/* Updated: 2019/11/25 13:56:07 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
/*
** compare two bytes strings (doesnt recognize a null terminated string)
** and return value of difference between first two different character
*/
#include "libft.h"
int ft_memcmp(const void *s1, const void *s2, size_t n)
{
unsigned char *frst;
unsigned char *scnd;
size_t i;
i = 0;
frst = (unsigned char *)s1;
scnd = (unsigned char *)s2;
while (i < n && frst[i] == scnd[i])
i++;
return ((i == n) ? 0 : frst[i] - scnd[i]);
}