-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstructions_1.c
45 lines (39 loc) · 1.31 KB
/
instructions_1.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* instructions_1.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ozakkare <ozakkare@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/07/09 12:03:38 by ozakkare #+# #+# */
/* Updated: 2021/07/09 12:04:38 by ozakkare ### ########.fr */
/* */
/* ************************************************************************** */
#include "./includes/push_swap.h"
int reverse_rotate(t_stack **head)
{
if (*head == NULL)
return (0);
(*head) = (*head)->prev;
return (0);
}
void rrr(t_stack **a, t_stack **b)
{
reverse_rotate(a);
reverse_rotate(b);
}
void rr(t_stack **head_a, t_stack **head_b)
{
rotate(head_a);
rotate(head_b);
}
void push_top(t_stack **to, t_stack **from)
{
int top;
if (*from != NULL)
{
top = (*from)->val;
push(to, top);
pop(from);
}
}