HtMaxMin.cc

Go to the documentation of this file.
00001 // HtMaxMin
00002 //
00003 // macros and tools for computing max and min of values
00004 //
00005 // Part of the ht://Dig package   <http://www.htdig.org/>
00006 // Copyright (c) 1999, 2000, 2001 The ht://Dig Group
00007 // For copyright details, see the file COPYING in your distribution
00008 // or the GNU General Public License version 2 or later
00009 // <http://www.gnu.org/copyleft/gpl.html>
00010 //
00011 // $Id: HtMaxMin_8cc-source.html,v 1.1 2008/06/08 10:12:54 sebdiaz Exp $
00012 //
00013 
00014 #include"HtMaxMin.h"
00015 
00016 unsigned int HtMaxMin::max_v(unsigned int *vals, int n)
00017 {
00018     unsigned int maxv = vals[0];
00019     for (int i = 1; i < n; i++) {
00020         unsigned int v = vals[i];
00021         if (v > maxv) {
00022             maxv = v;
00023         }
00024     }
00025     return (maxv);
00026 }
00027 
00028 unsigned short HtMaxMin::max_v(unsigned short *vals, int n)
00029 {
00030     unsigned short maxv = vals[0];
00031     for (int i = 1; i < n; i++) {
00032         unsigned short v = vals[i];
00033         if (v > maxv) {
00034             maxv = v;
00035         }
00036     }
00037     return (maxv);
00038 }
00039 
00040 unsigned char HtMaxMin::max_v(unsigned char *vals, int n)
00041 {
00042     unsigned char maxv = vals[0];
00043     for (int i = 1; i < n; i++) {
00044         unsigned char v = vals[i];
00045         if (v > maxv) {
00046             maxv = v;
00047         }
00048     }
00049     return (maxv);
00050 }
00051 
00052 unsigned int HtMaxMin::min_v(unsigned int *vals, int n)
00053 {
00054     unsigned int minv = vals[0];
00055     for (int i = 1; i < n; i++) {
00056         unsigned int v = vals[i];
00057         if (v < minv) {
00058             minv = v;
00059         }
00060     }
00061     return (minv);
00062 }
00063 
00064 unsigned short HtMaxMin::min_v(unsigned short *vals, int n)
00065 {
00066     unsigned short minv = vals[0];
00067     for (int i = 1; i < n; i++) {
00068         unsigned short v = vals[i];
00069         if (v < minv) {
00070             minv = v;
00071         }
00072     }
00073     return (minv);
00074 }
00075 
00076 unsigned char HtMaxMin::min_v(unsigned char *vals, int n)
00077 {
00078     unsigned char minv = vals[0];
00079     for (int i = 1; i < n; i++) {
00080         unsigned char v = vals[i];
00081         if (v < minv) {
00082             minv = v;
00083         }
00084     }
00085     return (minv);
00086 }

Generated on Sun Jun 8 10:56:39 2008 for GNUmifluz by  doxygen 1.5.5