diff --git a/common/alignment.hh b/common/alignment.hh
index b3b520b9fc7c66b0b600a1ccddeff4883a2c4588..20d4f2783f3445bfb0ff966fb9800a7d1eb94387 100644
--- a/common/alignment.hh
+++ b/common/alignment.hh
@@ -37,9 +37,13 @@ namespace Dune
     char padding2[N2];
   };
 
-#define ALIGNMENT_MODULO(a, b)   ((a) % (b) == 0 ? (b) : (a) % (b))
+#define ALIGNMENT_MODULO(a, b)   (a % b == 0 ? \
+                                  static_cast<std::size_t>(b) : \
+                                  static_cast<std::size_t>(a % b))
 #define ALIGNMENT_MIN(a, b)      (static_cast<std::size_t>(a) <   \
-                                  static_cast<std::size_t>(b) ? (a) : (b))
+                                  static_cast<std::size_t>(b) ? \
+                                  static_cast<std::size_t>(a) : \
+                                  static_cast<std::size_t>(b))
   template <class T, std::size_t N>
   struct AlignmentTester
   {