tgrekov-push_swap
HIVE push_swap July 2024
Loading...
Searching...
No Matches
wrap_ix.c
Go to the documentation of this file.
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* wrap_ix.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2024/07/15 08:04:15 by tgrekov #+# #+# */
9
/* Updated: 2024/07/17 08:30:29 by tgrekov ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
28
int
wrap_ix
(
int
i,
int
max)
29
{
30
if
(i < 0)
31
return
(max - 1);
32
return
(i % max);
33
}
wrap_ix
int wrap_ix(int i, int max)
Wrap a circular index, such that indices below zero are equal to max - i and indices above max contin...
Definition
wrap_ix.c:28
src
mandatory
utils
wrap_ix.c