summaryrefslogtreecommitdiff
path: root/c_src/raid/helper.h
blob: bf682882ea448b7dda06a88961da3148bf44355d (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * Copyright (C) 2013 Andrea Mazzoleni
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef __RAID_HELPER_H
#define __RAID_HELPER_H

/**
 * Inserts an integer in a sorted vector.
 *
 * This function can be used to insert indexes in order, ready to be used for
 * calling raid_rec().
 *
 * @n Number of integers currently in the vector.
 * @v Vector of integers already sorted.
 *   It must have extra space for the new elemet at the end.
 * @i Value to insert.
 */
void raid_insert(int n, int *v, int i);

/**
 * Sorts a small vector of integers.
 *
 * If you have indexes not in order, you can use this function to sort them
 * before calling raid_rec().
 *
 * @n Number of integers. No more than RAID_PARITY_MAX.
 * @v Vector of integers.
 */
void raid_sort(int n, int *v);

#endif