~ubuntu-branches/ubuntu/quantal/linphone/quantal

« back to all changes in this revision

Viewing changes to lpc10-1.5/median.c

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2004-06-30 13:58:16 UTC
  • Revision ID: james.westby@ubuntu.com-20040630135816-wwx75gdlodkqbabb
Tags: upstream-0.12.2
ImportĀ upstreamĀ versionĀ 0.12.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 
 
3
$Log: median.c,v $
 
4
Revision 1.1.1.1  2001/11/19 19:50:15  smorlat
 
5
First cvs.
 
6
 
 
7
Revision 1.1.1.1  2001/08/08 21:29:08  simon
 
8
First import
 
9
 
 
10
 * Revision 1.1  1996/08/19  22:31:31  jaf
 
11
 * Initial revision
 
12
 *
 
13
 
 
14
*/
 
15
 
 
16
#ifdef P_R_O_T_O_T_Y_P_E_S
 
17
extern integer median_(integer *d1, integer *d2, integer *d3);
 
18
#endif
 
19
 
 
20
/*  -- translated by f2c (version 19951025).
 
21
   You must link the resulting object file with the libraries:
 
22
        -lf2c -lm   (in that order)
 
23
*/
 
24
 
 
25
#include "f2c.h"
 
26
 
 
27
/* ********************************************************************* */
 
28
 
 
29
/*      MEDIAN Version 45G */
 
30
 
 
31
/* $Log: median.c,v $
 
32
/* Revision 1.1.1.1  2001/11/19 19:50:15  smorlat
 
33
/* First cvs.
 
34
/*
 
35
/* Revision 1.1.1.1  2001/08/08 21:29:08  simon
 
36
/* First import
 
37
/*
 
38
 * Revision 1.1  1996/08/19  22:31:31  jaf
 
39
 * Initial revision
 
40
 * */
 
41
/* Revision 1.2  1996/03/14  22:30:22  jaf */
 
42
/* Just rearranged the comments and local variable declarations a bit. */
 
43
 
 
44
/* Revision 1.1  1996/02/07 14:47:53  jaf */
 
45
/* Initial revision */
 
46
 
 
47
 
 
48
/* ********************************************************************* */
 
49
 
 
50
/*  Find median of three values */
 
51
 
 
52
/* Input: */
 
53
/*  D1,D2,D3 - Three input values */
 
54
/* Output: */
 
55
/*  MEDIAN - Median value */
 
56
 
 
57
integer median_(integer *d1, integer *d2, integer *d3)
 
58
{
 
59
    /* System generated locals */
 
60
    integer ret_val;
 
61
 
 
62
/*       Arguments */
 
63
    ret_val = *d2;
 
64
    if (*d2 > *d1 && *d2 > *d3) {
 
65
        ret_val = *d1;
 
66
        if (*d3 > *d1) {
 
67
            ret_val = *d3;
 
68
        }
 
69
    } else if (*d2 < *d1 && *d2 < *d3) {
 
70
        ret_val = *d1;
 
71
        if (*d3 < *d1) {
 
72
            ret_val = *d3;
 
73
        }
 
74
    }
 
75
    return ret_val;
 
76
} /* median_ */
 
77