Asterisk - The Open Source Telephony Project  18.5.0
median.c
Go to the documentation of this file.
1 /*
2 
3 $Log$
4 Revision 1.15 2004/06/26 03:50:14 markster
5 Merge source cleanups (bug #1911)
6 
7 Revision 1.14 2003/02/12 13:59:15 matteo
8 mer feb 12 14:56:57 CET 2003
9 
10 Revision 1.1.1.1 2003/02/12 13:59:15 matteo
11 mer feb 12 14:56:57 CET 2003
12 
13 Revision 1.2 2000/01/05 08:20:39 markster
14 Some OSS fixes and a few lpc changes to make it actually work
15 
16  * Revision 1.1 1996/08/19 22:31:31 jaf
17  * Initial revision
18  *
19 
20 */
21 
22 /* -- translated by f2c (version 19951025).
23  You must link the resulting object file with the libraries:
24  -lf2c -lm (in that order)
25 */
26 
27 #include "f2c.h"
28 
29 #ifdef P_R_O_T_O_T_Y_P_E_S
30 extern integer median_(integer *d1, integer *d2, integer *d3);
31 #endif
32 
33 /* ********************************************************************* */
34 
35 /* MEDIAN Version 45G */
36 
37 /* $Log$
38  * Revision 1.15 2004/06/26 03:50:14 markster
39  * Merge source cleanups (bug #1911)
40  *
41  * Revision 1.14 2003/02/12 13:59:15 matteo
42  * mer feb 12 14:56:57 CET 2003
43  *
44  * Revision 1.1.1.1 2003/02/12 13:59:15 matteo
45  * mer feb 12 14:56:57 CET 2003
46  *
47  * Revision 1.2 2000/01/05 08:20:39 markster
48  * Some OSS fixes and a few lpc changes to make it actually work
49  *
50  * Revision 1.1 1996/08/19 22:31:31 jaf
51  * Initial revision
52  * */
53 /* Revision 1.2 1996/03/14 22:30:22 jaf */
54 /* Just rearranged the comments and local variable declarations a bit. */
55 
56 /* Revision 1.1 1996/02/07 14:47:53 jaf */
57 /* Initial revision */
58 
59 
60 /* ********************************************************************* */
61 
62 /* Find median of three values */
63 
64 /* Input: */
65 /* D1,D2,D3 - Three input values */
66 /* Output: */
67 /* MEDIAN - Median value */
68 
70 {
71  /* System generated locals */
72  integer ret_val;
73 
74 /* Arguments */
75  ret_val = *d2;
76  if (*d2 > *d1 && *d2 > *d3) {
77  ret_val = *d1;
78  if (*d3 > *d1) {
79  ret_val = *d3;
80  }
81  } else if (*d2 < *d1 && *d2 < *d3) {
82  ret_val = *d1;
83  if (*d3 < *d1) {
84  ret_val = *d3;
85  }
86  }
87  return ret_val;
88 } /* median_ */
integer median_(integer *d1, integer *d2, integer *d3)
Definition: median.c:69
INT32 integer
Definition: lpc10.h:80