00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
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 }