include/common.h
branchpyrit
changeset 37 5f954c0d34fc
parent 34 28f6e8b9d5d1
child 44 3763b26244f0
--- a/include/common.h	Thu Dec 13 00:08:11 2007 +0100
+++ b/include/common.h	Fri Dec 14 00:05:54 2007 +0100
@@ -44,4 +44,40 @@
 	}
 }
 
+template<typename Type> const Type &min3(const Type &a, const Type &b, const Type &c)
+{
+	if (a <= b)
+	{
+		if (a <= c)
+			return a;
+		else
+			return c;
+	}
+	else
+	{
+		if (b <= c)
+			return b;
+		else
+			return c;
+	}
+}
+
+template<typename Type> const Type &max3(const Type &a, const Type &b, const Type &c)
+{
+	if (a >= b)
+	{
+		if (a >= c)
+			return a;
+		else
+			return c;
+	}
+	else
+	{
+		if (b >= c)
+			return b;
+		else
+			return c;
+	}
+}
+
 #endif