Utility functions to sort and join uint64_t arrays.
More...
#include <inttypes.h>
#include <stdlib.h>
Go to the source code of this file.
|
static void | sort_uint64_t (uint64_t *arr, uint64_t *tmp, uint32_t nitems) |
|
static void | order_uint64_t (uint64_t *arr, uint64_t *tmp, uint32_t *idx, uint32_t *tdx, uint32_t nitems) |
|
static void | reverse_uint64_t (uint64_t *arr, uint64_t nitems) |
|
static uint64_t * | unique_uint64_t (uint64_t *arr, uint64_t nitems) |
|
static uint64_t * | intersection_uint64_t (uint64_t *a_arr, uint64_t a_nitems, uint64_t *b_arr, uint64_t b_nitems, uint64_t *o_arr) |
|
static uint64_t * | union_uint64_t (uint64_t *a_arr, uint64_t a_nitems, uint64_t *b_arr, uint64_t b_nitems, uint64_t *o_arr) |
|
Collection of utility functions to sort and join uint64_t arrays.
#define RADIX_SORT_COUNT_BLOCK |
#define RADIX_SORT_ITERATION_BLOCK |
( |
|
A, |
|
|
|
B, |
|
|
|
BYTE, |
|
|
|
SHIFT |
|
) |
| |
Value:for (i = 0; i < nitems; i++) \
{ \
v = (A)[i]; \
(B)[c##BYTE[((v >> (SHIFT)) & 0xff)]++] = v; \
}
static uint64_t* intersection_uint64_t |
( |
uint64_t * |
a_arr, |
|
|
uint64_t |
a_nitems, |
|
|
uint64_t * |
b_arr, |
|
|
uint64_t |
b_nitems, |
|
|
uint64_t * |
o_arr |
|
) |
| |
|
inlinestatic |
Returns the intersection of two sorted uint64_t arrays.
- Parameters
-
a_arr | Pointer to the first element of the first array to process. |
a_nitems | Number of elements in the first array. |
b_arr | Pointer to the first element of the second array to process. |
b_nitems | Number of elements in the second array. |
o_arr | Pointer to the first element or the output array. |
- Returns
- Pointer to the end of the array.
static void order_uint64_t |
( |
uint64_t * |
arr, |
|
|
uint64_t * |
tmp, |
|
|
uint32_t * |
idx, |
|
|
uint32_t * |
tdx, |
|
|
uint32_t |
nitems |
|
) |
| |
|
inlinestatic |
Sorts in-memory an array of uint64_t values in ascending order ans store the permutation order index.
- Parameters
-
arr | Pointer to the first element of the array to process. |
tmp | Pointer to the first element of a temporary array. |
idx | Pointer to the first element of the index array to be returned. |
tdx | Pointer to the first element of a temporary index array. |
nitems | Number of elements in the array. |
static void reverse_uint64_t |
( |
uint64_t * |
arr, |
|
|
uint64_t |
nitems |
|
) |
| |
|
inlinestatic |
Reverse in-place an array of uint64_t values.
- Parameters
-
arr | Pointer to the first element of the array to process. |
nitems | Number of elements in the array. |
static void sort_uint64_t |
( |
uint64_t * |
arr, |
|
|
uint64_t * |
tmp, |
|
|
uint32_t |
nitems |
|
) |
| |
|
inlinestatic |
Sorts in-memory an array of uint64_t values in ascending order.
- Parameters
-
arr | Pointer to the first element of the array to process. |
tmp | Pointer to the first element of a temporary array. |
nitems | Number of elements in the array. |
static uint64_t* union_uint64_t |
( |
uint64_t * |
a_arr, |
|
|
uint64_t |
a_nitems, |
|
|
uint64_t * |
b_arr, |
|
|
uint64_t |
b_nitems, |
|
|
uint64_t * |
o_arr |
|
) |
| |
|
inlinestatic |
Returns the union of two sorted uint64_t arrays.
- Parameters
-
a_arr | Pointer to the first element of the first array to process. |
a_nitems | Number of elements in the first array. |
b_arr | Pointer to the first element of the second array to process. |
b_nitems | Number of elements in the second array. |
o_arr | Pointer to the first element or the output array. |
- Returns
- Pointer to the end of the array.
static uint64_t* unique_uint64_t |
( |
uint64_t * |
arr, |
|
|
uint64_t |
nitems |
|
) |
| |
|
inlinestatic |
Eliminates all but the first element from every consecutive group of equal values.
- Parameters
-
arr | Pointer to the first element of the array to process. |
nitems | Number of elements in the array. |
- Returns
- Pointer to the end of the array.