include/common.h
branchpyrit
changeset 37 5f954c0d34fc
parent 34 28f6e8b9d5d1
child 44 3763b26244f0
equal deleted inserted replaced
36:b490093b0ac3 37:5f954c0d34fc
    42 		va_end(ap);
    42 		va_end(ap);
    43 		fflush(stdout);
    43 		fflush(stdout);
    44 	}
    44 	}
    45 }
    45 }
    46 
    46 
       
    47 template<typename Type> const Type &min3(const Type &a, const Type &b, const Type &c)
       
    48 {
       
    49 	if (a <= b)
       
    50 	{
       
    51 		if (a <= c)
       
    52 			return a;
       
    53 		else
       
    54 			return c;
       
    55 	}
       
    56 	else
       
    57 	{
       
    58 		if (b <= c)
       
    59 			return b;
       
    60 		else
       
    61 			return c;
       
    62 	}
       
    63 }
       
    64 
       
    65 template<typename Type> const Type &max3(const Type &a, const Type &b, const Type &c)
       
    66 {
       
    67 	if (a >= b)
       
    68 	{
       
    69 		if (a >= c)
       
    70 			return a;
       
    71 		else
       
    72 			return c;
       
    73 	}
       
    74 	else
       
    75 	{
       
    76 		if (b >= c)
       
    77 			return b;
       
    78 		else
       
    79 			return c;
       
    80 	}
       
    81 }
       
    82 
    47 #endif
    83 #endif