2026-04-02 16:00:27 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2026-04-02 16:25:49 +02:00
|
|
|
// Copyright (C) 2013 Andrea Mazzoleni
|
2014-01-10 09:02:12 +01:00
|
|
|
|
2026-10-13 11:20:19 +02:00
|
|
|
#ifndef RAID_HELPER_H
|
|
|
|
|
#define RAID_HELPER_H
|
2014-01-10 09:02:12 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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.
|
2020-05-02 14:21:40 +02:00
|
|
|
* It must have extra space for the new element at the end.
|
2014-01-10 09:02:12 +01:00
|
|
|
* @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
|