mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 00:41:57 +00:00
fix calcul_range function cause i didnt manage to scan the last value on the pile
This commit is contained in:
@@ -32,11 +32,14 @@ int get_next_lower(t_stack *first, int old_lower)
|
||||
{
|
||||
t_stack *tmp;
|
||||
int next_lower;
|
||||
int skip_first;
|
||||
|
||||
tmp = first;
|
||||
skip_first = 1;
|
||||
next_lower = 2147483647;
|
||||
while (tmp->next != first)
|
||||
while (tmp != first || skip_first)
|
||||
{
|
||||
skip_first = 0;
|
||||
if (old_lower < tmp->value && tmp->value <= next_lower)
|
||||
{
|
||||
next_lower = tmp->value;
|
||||
@@ -50,6 +53,7 @@ int calcul_range(int value, int range)
|
||||
{
|
||||
int max_range;
|
||||
|
||||
|
||||
max_range = 0;
|
||||
if (value < 0)
|
||||
while (max_range > value)
|
||||
|
||||
Reference in New Issue
Block a user