fixing some issues on the checker error and need to fix a last thing on the bucket range algo

This commit is contained in:
Maoake Teriierooiterai
2026-01-09 14:57:05 +01:00
parent be9d265fb5
commit ad855e5915
4 changed files with 19 additions and 1 deletions

View File

@@ -43,6 +43,8 @@ int get_next_lower(t_stack *first, int old_lower)
if (old_lower < tmp->value && tmp->value <= next_lower) if (old_lower < tmp->value && tmp->value <= next_lower)
{ {
next_lower = tmp->value; next_lower = tmp->value;
if (next_lower == -2147483648)
return (next_lower);
} }
tmp = tmp->next; tmp = tmp->next;
} }
@@ -53,7 +55,10 @@ int calcul_range(int value, int range)
{ {
int max_range; int max_range;
max_range = 0; max_range = 0;
if (value == 2147483647)
return (value);
if (value < 0) if (value < 0)
while (max_range > value) while (max_range > value)
max_range -= range; max_range -= range;

View File

@@ -21,6 +21,8 @@ static int scan_str_is_digit(char *tab)
{ {
if (!ft_isdigit(tab[i]) && (tab[i] == '-' && !ft_isdigit(tab[i + 1]))) if (!ft_isdigit(tab[i]) && (tab[i] == '-' && !ft_isdigit(tab[i + 1])))
return (0); return (0);
if (tab[i] == '+' && !ft_isdigit(tab[i + 1]))
return (0);
i++; i++;
} }
return (1); return (1);

View File

@@ -12,6 +12,13 @@
#include "parsing.h" #include "parsing.h"
// static int calcul_sign(char c)
// {
// if (c == '-')
// return (-1);
// return (1);
// }
static int verif_atoi(const char *nptr) static int verif_atoi(const char *nptr)
{ {
size_t i; size_t i;
@@ -21,6 +28,8 @@ static int verif_atoi(const char *nptr)
i = 0; i = 0;
tmp = 0; tmp = 0;
before = 0; before = 0;
if (ft_strncmp("-2147483648", nptr, 12))
return (1);
while ((nptr[i] >= 9 && nptr[i] <= 13) || nptr[i] == ' ') while ((nptr[i] >= 9 && nptr[i] <= 13) || nptr[i] == ' ')
i++; i++;
if (nptr[i] == '-' || nptr[i] == '+') if (nptr[i] == '-' || nptr[i] == '+')

View File

@@ -48,6 +48,8 @@ void complex(t_stacks *stacks)
void adaptive(t_stacks *stacks) void adaptive(t_stacks *stacks)
{ {
(void)stacks; //simple(stacks);
medium(stacks);
//complex(stacks);
return ; return ;
} }