mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 08:41:58 +00:00
fix rotates functions
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/12/08 14:43:45 by dgaillet #+# #+# */
|
/* Created: 2025/12/08 14:43:45 by dgaillet #+# #+# */
|
||||||
/* Updated: 2025/12/08 14:50:40 by dgaillet ### ########lyon.fr */
|
/* Updated: 2025/12/08 14:52:53 by dgaillet ### ########lyon.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -14,13 +14,13 @@
|
|||||||
|
|
||||||
void rra(t_stacks *stacks)
|
void rra(t_stacks *stacks)
|
||||||
{
|
{
|
||||||
if (stacks->a && stacks->a->previous)
|
if (stacks && stacks->a && stacks->a->previous)
|
||||||
stacks->a = stacks->a->previous;
|
stacks->a = stacks->a->previous;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rrb(t_stacks *stacks)
|
void rrb(t_stacks *stacks)
|
||||||
{
|
{
|
||||||
if (stacks->b && stacks->b->previous)
|
if (stacks && stacks->b && stacks->b->previous)
|
||||||
stacks->b = stacks->b->previous;
|
stacks->b = stacks->b->previous;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/12/08 14:32:10 by dgaillet #+# #+# */
|
/* Created: 2025/12/08 14:32:10 by dgaillet #+# #+# */
|
||||||
/* Updated: 2025/12/08 14:42:04 by dgaillet ### ########lyon.fr */
|
/* Updated: 2025/12/08 14:52:37 by dgaillet ### ########lyon.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -14,17 +14,13 @@
|
|||||||
|
|
||||||
void ra(t_stacks *stacks)
|
void ra(t_stacks *stacks)
|
||||||
{
|
{
|
||||||
if (!stacks)
|
if (stacks && stacks->a && stacks->a->next)
|
||||||
return ;
|
|
||||||
if (stacks->a->next)
|
|
||||||
stacks->a = stacks->a->next;
|
stacks->a = stacks->a->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rb(t_stacks *stacks)
|
void rb(t_stacks *stacks)
|
||||||
{
|
{
|
||||||
if (!stacks)
|
if (stacks && stacks->b && stacks->b->next)
|
||||||
return ;
|
|
||||||
if (stacks->b->next)
|
|
||||||
stacks->b = stacks->b->next;
|
stacks->b = stacks->b->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user