Update header file for both stacks + rotate functions added

This commit is contained in:
David Gailleton
2025-12-08 14:42:55 +01:00
parent b26780671b
commit 430af885a9
2 changed files with 42 additions and 1 deletions

35
stack_functions/rotate.c Normal file
View File

@@ -0,0 +1,35 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rotate.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/12/08 14:32:10 by dgaillet #+# #+# */
/* Updated: 2025/12/08 14:42:04 by dgaillet ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void ra(t_stacks *stacks)
{
if (!stacks)
return ;
if (stacks->a->next)
stacks->a = stacks->a->next;
}
void rb(t_stacks *stacks)
{
if (!stacks)
return ;
if (stacks->b->next)
stacks->b = stacks->b->next;
}
void rr(t_stacks *stacks)
{
ra(stacks);
rb(stacks);
}