comparf.c File Reference

Compare two float values to sort descending. More...

#include <utils.h>
Include dependency graph for comparf.c:

Go to the source code of this file.

Functions

int comparf (const void *a, const void *b)
 Compare two float values to sort descending.

Detailed Description

Compare two float values to sort descending.

Definition in file comparf.c.


Function Documentation

int comparf ( const void *  a,
const void *  b 
)

Compare two float values to sort descending.

Parameters:
[in] a First input value
[in] b Second input value
Returns:
Comparison result

Definition at line 58 of file comparf.c.

00059 {
00067   /* Cast to float */
00068   float *n1 = (float *) a;
00069   float *n2 = (float *) b;
00070 
00071   /* Descending comparison */
00072   if (*n1 < *n2)
00073     return 1;
00074   else if (*n1 > *n2)
00075     return -1;
00076   else
00077     return 0;
00078 }


Generated on 12 May 2016 for DSCLIM by  doxygen 1.6.1