diff --git a/stack_functions/rev_rotate.c b/stack_functions/rev_rotate.c new file mode 100644 index 0000000..e0b5175 --- /dev/null +++ b/stack_functions/rev_rotate.c @@ -0,0 +1,31 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* rev_rotate.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: dgaillet +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/12/08 14:43:45 by dgaillet #+# #+# */ +/* Updated: 2025/12/08 14:50:40 by dgaillet ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include "push_swap.h" + +void rra(t_stacks *stacks) +{ + if (stacks->a && stacks->a->previous) + stacks->a = stacks->a->previous; +} + +void rrb(t_stacks *stacks) +{ + if (stacks->b && stacks->b->previous) + stacks->b = stacks->b->previous; +} + +void rrr(t_stacks *stacks) +{ + rra(stacks); + rrb(stacks); +}