-
Notifications
You must be signed in to change notification settings - Fork 0
/
reverse_rotate.c
46 lines (39 loc) · 1.49 KB
/
reverse_rotate.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* reverse_rotate.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kristori <kristori@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/19 15:18:05 by kristori #+# #+# */
/* Updated: 2022/12/19 16:15:08 by kristori ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void ft_rra(t_stack **stack_a)
{
int tmp;
tmp = ft_get_last_item(*stack_a);
ft_remove_last_node(stack_a);
ft_add_first(stack_a, tmp);
write(1, "rra\n", 4);
}
void ft_rrb(t_stack **stack_b)
{
int tmp;
tmp = ft_get_last_item(*stack_b);
ft_remove_last_node(stack_b);
ft_add_first(stack_b, tmp);
write(1, "rrb\n", 4);
}
void ft_rrr(t_stack **stack_a, t_stack **stack_b)
{
int tmp;
tmp = ft_get_last_item(*stack_a);
ft_remove_last_node(stack_a);
ft_add_first(stack_a, tmp);
tmp = ft_get_last_item(*stack_b);
ft_remove_last_node(stack_b);
ft_add_first(stack_b, tmp);
write(1, "rrr\n", 4);
}