-
Notifications
You must be signed in to change notification settings - Fork 0
/
push_swap_op1.c
56 lines (48 loc) · 1.63 KB
/
push_swap_op1.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
47
48
49
50
51
52
53
54
55
56
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap_op1.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jeongble <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/21 14:51:05 by jeongble #+# #+# */
/* Updated: 2022/07/22 07:47:19 by jeongble ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int sa(t_stack *stacks)
{
return (swap(&(stacks->stack_a), &(stacks->tail_a)));
}
int sb(t_stack *stacks)
{
return (swap(&(stacks->stack_b), &(stacks->tail_b)));
}
int ss(t_stack *stacks)
{
return (sa(stacks) || sb(stacks));
}
int pa(t_stack *stacks)
{
t_num **dst;
t_num **dst_tail;
t_num **src;
t_num **src_tail;
dst = &(stacks->stack_a);
dst_tail = &(stacks->tail_a);
src = &(stacks->stack_b);
src_tail = &(stacks->tail_b);
return (push(dst, dst_tail, src, src_tail));
}
int pb(t_stack *stacks)
{
t_num **dst;
t_num **dst_tail;
t_num **src;
t_num **src_tail;
dst = &(stacks->stack_b);
dst_tail = &(stacks->tail_b);
src = &(stacks->stack_a);
src_tail = &(stacks->tail_a);
return (push(dst, dst_tail, src, src_tail));
}