2022-11-23 15:44:27 -05:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* ft_p.c :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
/* Created: 2022/11/09 16:38:34 by cchauvet #+# #+# */
|
2022-12-07 08:19:16 -05:00
|
|
|
/* Updated: 2022/12/07 14:15:24 by cchauvet ### ########.fr */
|
2022-11-23 15:44:27 -05:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#include "pushswap.h"
|
|
|
|
|
2022-12-06 11:35:45 -05:00
|
|
|
void ft_p(unsigned int *tab_src, unsigned int *tab_dst)
|
2022-11-23 15:44:27 -05:00
|
|
|
{
|
2022-12-07 08:19:16 -05:00
|
|
|
unsigned int i;
|
2022-11-23 15:44:27 -05:00
|
|
|
|
2022-12-07 08:19:16 -05:00
|
|
|
i = ft_tablen(tab_dst) + 1;
|
|
|
|
while (i > 0)
|
|
|
|
{
|
|
|
|
tab_dst[i] = tab_dst[i - 1];
|
|
|
|
i--;
|
|
|
|
}
|
|
|
|
tab_dst[0] = tab_src[0];
|
|
|
|
i = 0;
|
|
|
|
while (tab_src[i] != STOP_VALUE)
|
|
|
|
{
|
|
|
|
tab_src[i] = tab_src[i + 1];
|
|
|
|
i++;
|
|
|
|
}
|
2022-11-29 08:06:22 -05:00
|
|
|
}
|
|
|
|
|
2022-12-01 11:15:17 -05:00
|
|
|
void ft_pb(unsigned int *tab_a, unsigned int *tab_b)
|
2022-11-29 08:06:22 -05:00
|
|
|
{
|
2022-11-30 07:21:32 -05:00
|
|
|
ft_p(tab_a, tab_b);
|
|
|
|
ft_putstr("pb\n");
|
2022-11-29 08:06:22 -05:00
|
|
|
}
|
|
|
|
|
2022-12-01 11:15:17 -05:00
|
|
|
void ft_pa(unsigned int *tab_a, unsigned int *tab_b)
|
2022-11-29 08:06:22 -05:00
|
|
|
{
|
2022-11-30 07:21:32 -05:00
|
|
|
ft_p(tab_b, tab_a);
|
|
|
|
ft_putstr("pa\n");
|
2022-11-23 15:44:27 -05:00
|
|
|
}
|