-
Notifications
You must be signed in to change notification settings - Fork 0
/
anhidrosis.c
57 lines (54 loc) · 1.65 KB
/
anhidrosis.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
57
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* anhidrosis.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cgleason <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/08/05 12:35:45 by cgleason #+# #+# */
/* Updated: 2018/08/05 12:35:55 by cgleason ### ########.fr */
/* */
/* ************************************************************************** */
#include "swap_push.h"
void small_stuff(t_dblstck **src, t_dblstck **dst, t_range range,
t_bool dstisb)
{
if (subset_issorted(*src, SIZE, !dstisb))
return ;
if (SIZE == stck_len(*src))
{
dbl_small_stuff(src, dst, range, dstisb);
return ;
}
if (SIZE == 2)
{
(dstisb) ? ft_putendl("sa") : ft_putendl("sb");
swap(src);
}
else if (SIZE == 3)
{
if (dstisb)
three(src, range);
else
three_dstisntb(src, range);
}
}
void dbl_small_stuff(t_dblstck **src, t_dblstck **dst, t_range range,
t_bool dstisb)
{
(void)dst;
if (subset_issorted(*src, SIZE, !dstisb))
return ;
if (SIZE == 2)
{
(dstisb) ? ft_putendl("sa") : ft_putendl("sb");
swap(src);
}
else if (SIZE == 3)
{
if (dstisb)
dbl_three(src, range);
else
dbl_three_dstisntb(src, range);
}
}