forked from ITA-Solar/rh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
order.c
51 lines (36 loc) · 1.25 KB
/
order.c
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
44
45
46
47
48
49
50
51
/* ------- file: -------------------------- order.c -----------------
Version: rh2.0
Author: Han Uitenbroek ([email protected])
Last modified: Thu Feb 4 22:09:06 1999 --
-------------------------- ----------RH-- */
/* --- Functions for ordering arrays of values. See ``man qsort''
for examples. -- -------------- */
#include "rh.h"
/* --- Function prototypes -- -------------- */
/* --- Global variables -- -------------- */
/* ------- begin -------------------------- qsascend.c -------------- */
int qsascend(const void *v1, const void *v2 )
{
double f1, f2;
f1 = *(double*) v1; f2 = *(double *) v2;
if (f1 < f2)
return -1;
else if (f1 > f2)
return 1;
else
return 0;
}
/* ------- end ---------------------------- qsascend.c -------------- */
/* ------- begin -------------------------- qsdescend.c ------------- */
int qsdescend(const void *v1, const void *v2 )
{
double f1, f2;
f1 = *(double*) v1; f2 = *(double *) v2;
if (f1 > f2)
return -1;
else if (f1 < f2)
return 1;
else
return 0;
}
/* ------- end ---------------------------- qsdescend.c ------------- */