|
@@ -108,4 +108,14 @@ int eprintf(int level,
|
|
|
#define pr_debug3(fmt, ...) pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__)
|
|
|
#define pr_debug4(fmt, ...) pr_debugN(4, pr_fmt(fmt), ##__VA_ARGS__)
|
|
|
|
|
|
+/*
|
|
|
+ * This looks more complex than it should be. But we need to
|
|
|
+ * get the type for the ~ right in round_down (it needs to be
|
|
|
+ * as wide as the result!), and we want to evaluate the macro
|
|
|
+ * arguments just once each.
|
|
|
+ */
|
|
|
+#define __round_mask(x, y) ((__typeof__(x))((y)-1))
|
|
|
+#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
|
|
|
+#define round_down(x, y) ((x) & ~__round_mask(x, y))
|
|
|
+
|
|
|
#endif
|