Archived
1
0

oprations done

This commit is contained in:
2024-02-14 11:41:57 +01:00
parent 220751604a
commit 7930a36c0c
22 changed files with 113 additions and 190 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/08 18:08:51 by adjoly #+# #+# */
/* Updated: 2024/02/09 15:48:39 by adjoly ### ########.fr */
/* Updated: 2024/02/12 17:24:55 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */

BIN
operations/ft_pushstack.o Normal file

Binary file not shown.

View File

@ -0,0 +1,42 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_reverserotate.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/13 13:41:25 by adjoly #+# #+# */
/* Updated: 2024/02/13 14:05:13 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "../push_swap.h"
void ft_reverserotate(t_stack **stack)
{
t_stack *bfrlast;
t_stack *last;
t_stack *stack_start;
if (!stack || !(*stack) || !(*stack)->next)
return ;
bfrlast = ft_stackbeforelast(*stack);
last = ft_stacklast(*stack);
bfrlast->next = NULL;
stack_start = (*stack);
(*stack) = last;
(*stack)->next = stack_start;
}
void ft_reverserotate_a(t_stack **stack_a)
{
ft_putendl_fd("rra", STDOUT_FILENO);
ft_reverserotate(stack_a);
}
void ft_reverserotate_b(t_stack **stack_b)
{
ft_putendl_fd("rrb", STDOUT_FILENO);
ft_reverserotate(stack_b);
}

Binary file not shown.

View File

@ -0,0 +1,38 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_rotatestack.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/13 12:53:55 by adjoly #+# #+# */
/* Updated: 2024/02/13 13:36:51 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "../push_swap.h"
void ft_rotatestack(t_stack **stack)
{
t_stack *tmp_last;
t_stack *start;
start = (*stack)->next;
tmp_last = ft_stacklast(*stack);
tmp_last->next = *stack;
(*stack)->next = NULL;
(*stack) = start;
}
void ft_rotatestack_a(t_stack **stack_a)
{
ft_putendl_fd("ra", STDOUT_FILENO);
ft_rotatestack(stack_a);
}
void ft_rotatestack_b(t_stack **stack_b)
{
ft_putendl_fd("rb", STDOUT_FILENO);
ft_rotatestack(stack_b);
}

BIN
operations/ft_rotatestack.o Normal file

Binary file not shown.

BIN
operations/ft_swapstack.o Normal file

Binary file not shown.