push_swap/src/app/target.c

24 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* target.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/29 20:30:27 by maiboyer #+# #+# */
/* Updated: 2024/02/02 22:40:55 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "app/rotate.h"
#include "app/target.h"
t_rotation target(t_usize from, t_usize to, t_usize ring_size)
{
if (ring_size == 0)
ring_size++;
if (from > to)
return (reverse(from - to, ring_size));
else
return (forward(to - from, ring_size));
}