Defines | Functions
qsort-def.h File Reference

QSort preprocessor metaprogram. More...

#include "host.h"
#include <assert.h>
Include dependency graph for qsort-def.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define VL_QSORT_array   VL_QSORT_type*
#define VL_QSORT_array_const   VL_QSORT_type const*
#define VL_QSORT_cmp   VL_XCAT(VL_QSORT_prefix, _cmp)
#define VL_QSORT_swap   VL_XCAT(VL_QSORT_prefix, _swap)

Functions

VL_INLINE VL_QSORT_type VL_QSORT_cmp (VL_QSORT_array_const array, vl_uindex indexA, vl_uindex indexB)
 Compare two array elements.
VL_INLINE void VL_QSORT_swap (VL_QSORT_array array, vl_uindex indexA, vl_uindex indexB)
 Swap two array elements.

Detailed Description

QSort preprocessor metaprogram.

Author:
Andrea Vedaldi

Overview

qsort-def.h is a metaprogram to define specialized instances of the quick-sort algorithm.

Usage

qsort-def.h is used to define a specialization of the ::VL_QSORT_sort function that operates on a given type of array. For instance the code

#define VL_QSORT_type float
#define VL_QSORT_prefix my_qsort
#include <vl/qsort-def.h>

defines a function my_qsort_sort that operates on an array of floats.

Todo:
large array compatibility.

Definition in file qsort-def.h.


Define Documentation

Definition at line 49 of file qsort-def.h.

#define VL_QSORT_array_const   VL_QSORT_type const*

Definition at line 50 of file qsort-def.h.

#define VL_QSORT_cmp   VL_XCAT(VL_QSORT_prefix, _cmp)

Definition at line 62 of file qsort-def.h.

#define VL_QSORT_swap   VL_XCAT(VL_QSORT_prefix, _swap)

Definition at line 87 of file qsort-def.h.


Function Documentation

VL_INLINE VL_QSORT_type VL_QSORT_cmp ( VL_QSORT_array_const  array,
vl_uindex  indexA,
vl_uindex  indexB 
)

Compare two array elements.

Parameters:
arrayqsort array.
indexAindex of the first element A to compare.
indexBindex of the second element B to comapre.
Returns:
a negative number if A<B, 0 if A==B, and a positive number if if A>B.

Definition at line 74 of file qsort-def.h.

VL_INLINE void VL_QSORT_swap ( VL_QSORT_array  array,
vl_uindex  indexA,
vl_uindex  indexB 
)

Swap two array elements.

Parameters:
arrayqsort array.
indexAindex of the first element to swap.
indexBindex of the second element to swap.

The function swaps the two elements a and @ b. The function uses a temporary element of type VL_QSORT_type and the copy operator =.

Definition at line 101 of file qsort-def.h.



libvlfeat
Author(s): Andrea Vedaldi
autogenerated on Thu Jun 6 2019 20:25:52