40 lines
1.4 KiB
C
40 lines
1.4 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_p.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/11/09 16:38:34 by cchauvet #+# #+# */
|
|
/* Updated: 2022/12/01 16:17:17 by cchauvet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "pushswap.h"
|
|
|
|
void ft_p(unsigned *tab_src, unsigned *tab_dst)
|
|
{
|
|
int size_src;
|
|
int size_dst;
|
|
|
|
size_src = ft_tablen(tab_src);
|
|
size_dst = ft_tablen(tab_dst);
|
|
if (size_src == 0)
|
|
return ;
|
|
tab_dst[size_dst] = tab_src[size_src - 1];
|
|
tab_dst[size_dst + 1] = -1;
|
|
tab_src[size_src - 1] = -1;
|
|
}
|
|
|
|
void ft_pb(unsigned int *tab_a, unsigned int *tab_b)
|
|
{
|
|
ft_p(tab_a, tab_b);
|
|
ft_putstr("pb\n");
|
|
}
|
|
|
|
void ft_pa(unsigned int *tab_a, unsigned int *tab_b)
|
|
{
|
|
ft_p(tab_b, tab_a);
|
|
ft_putstr("pa\n");
|
|
}
|