skeletton untested project

This commit is contained in:
thrieg 2025-12-11 06:18:16 +01:00
commit 6fc620e8f4
187 changed files with 6584 additions and 0 deletions

View file

@ -0,0 +1,79 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_hashmap_basic_cmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/08 13:18:52 by thrieg #+# #+# */
/* Updated: 2025/02/16 19:08:27 by thrieg ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_hashmap_private.h"
#include <limits.h>
// Comparison function for integers
int int_cmp(void *key1, void *key2)
{
int a;
int b;
a = *(int *)key1;
b = *(int *)key2;
if (a < b)
return (-1);
else if (a > b)
return (1);
else
return (0);
}
// Comparison function for strings
int cmp_str(void *key1, void *key2)
{
return (ft_strcmp((char *)key1, (char *)key2));
}
// Comparison function for unsigned chars
int cmp_uchar(void *key1, void *key2)
{
unsigned char *c1;
unsigned char *c2;
c1 = (unsigned char *)key1;
c2 = (unsigned char *)key2;
return (*c1 - *c2);
}
// Comparison function for unsigned integers
int uint_cmp(void *key1, void *key2)
{
unsigned int a;
unsigned int b;
a = *(unsigned int *)key1;
b = *(unsigned int *)key2;
if (a < b)
return (-1);
else if (a > b)
return (1);
else
return (0);
}
// Comparison function for size_t
int sizet_cmp(void *key1, void *key2)
{
size_t a;
size_t b;
a = *(size_t *)key1;
b = *(size_t *)key2;
if (a < b)
return (-1);
else if (a > b)
return (1);
else
return (0);
}