blob: 0bc447fdfb1c42b64a85af6d2ae5ecf037e92c5d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_reverse.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/10 05:07:13 by cacharle #+# #+# */
/* Updated: 2020/02/10 05:19:22 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft_algo.h"
void ft_reverse(void *base, size_t nel, size_t width)
{
size_t i;
i = 0;
nel--;
while (i < nel)
{
ft_memswap(base + i * width, base + nel * width, width);
i++;
nel--;
}
}
|