Index: kernel/generic/include/macros.h
===================================================================
--- kernel/generic/include/macros.h	(revision d6b8e9d8308224879651543b1f013b54577eb27b)
+++ kernel/generic/include/macros.h	(revision 6bf612bbbe34393f2172ff7651103f824ecdaa4c)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup generic	
+/** @addtogroup generic
  * @{
  */
@@ -38,21 +38,24 @@
 #include <arch/types.h>
 
-#define isdigit(d)	(((d) >= '0') && ((d) <= '9'))
-#define islower(c)	(((c) >= 'a') && ((c) <= 'z'))
-#define isupper(c)	(((c) >= 'A') && ((c) <= 'Z'))
-#define isalpha(c)	(is_lower((c)) || is_upper((c)))
-#define isalphanum(c)	(is_alpha((c)) || is_digit((c)))
-#define isspace(c)	(((c) == ' ') || ((c) == '\t') || ((c) == '\n') || \
-			    ((c) == '\r'))
+#define isdigit(d)     (((d) >= '0') && ((d) <= '9'))
+#define islower(c)     (((c) >= 'a') && ((c) <= 'z'))
+#define isupper(c)     (((c) >= 'A') && ((c) <= 'Z'))
+#define isalpha(c)     (is_lower((c)) || is_upper((c)))
+#define isalphanum(c)  (is_alpha((c)) || is_digit((c)))
+#define isspace(c) \
+	(((c) == ' ') || ((c) == '\t') || ((c) == '\n') || ((c) == '\r'))
 
-#define min(a, b)	((a) < (b) ? (a) : (b))
-#define max(a, b)	((a) > (b) ? (a) : (b))
+#define min(a, b)  ((a) < (b) ? (a) : (b))
+#define max(a, b)  ((a) > (b) ? (a) : (b))
+
+#define min3(a, b, c)  ((a) < (b) ? (min(a, c)) : (min(b, c)))
+#define max3(a, b, c)  ((a) > (b) ? (max(a, c)) : (max(b, c)))
 
 /** Return true if the intervals overlap.
  *
- * @param s1		Start address of the first interval.
- * @param sz1		Size of the first interval.
- * @param s2		Start address of the second interval.
- * @param sz2		Size of the second interval.
+ * @param s1  Start address of the first interval.
+ * @param sz1 Size of the first interval.
+ * @param s2  Start address of the second interval.
+ * @param sz2 Size of the second interval.
  */
 static inline int overlaps(uintptr_t s1, size_t sz1, uintptr_t s2, size_t sz2)
@@ -60,20 +63,20 @@
 	uintptr_t e1 = s1 + sz1;
 	uintptr_t e2 = s2 + sz2;
-
-	return (s1 < e2) && (s2 < e1);
+	
+	return ((s1 < e2) && (s2 < e1));
 }
 
 /* Compute overlapping of physical addresses */
-#define PA_overlaps(x, szx, y, szy)	\
+#define PA_overlaps(x, szx, y, szy) \
 	overlaps(KA2PA((x)), (szx), KA2PA((y)), (szy))
 
-#define SIZE2KB(size) ((size) >> 10)
-#define SIZE2MB(size) ((size) >> 20)
+#define SIZE2KB(size)  ((size) >> 10)
+#define SIZE2MB(size)  ((size) >> 20)
 
-#define KB2SIZE(kb) ((kb) << 10)
-#define MB2SIZE(mb) ((mb) << 20)
+#define KB2SIZE(kb)  ((kb) << 10)
+#define MB2SIZE(mb)  ((mb) << 20)
 
-#define STRING(arg) STRING_ARG(arg)
-#define STRING_ARG(arg) #arg
+#define STRING(arg)      STRING_ARG(arg)
+#define STRING_ARG(arg)  #arg
 
 /** Pseudorandom generator
