From dc36b63acb7ea575a408f3560420a7615ab34f54 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Fri, 26 Jun 2015 11:31:29 +0200 Subject: [PATCH] base: turn align_addr tool into constexpr Thereby, the tool can be used to calculate static compile-time values. Ref #1588 --- repos/base/include/util/misc_math.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/repos/base/include/util/misc_math.h b/repos/base/include/util/misc_math.h index 8c686dfa51..a672b85c41 100644 --- a/repos/base/include/util/misc_math.h +++ b/repos/base/include/util/misc_math.h @@ -30,15 +30,15 @@ namespace Genode { * Alignment to the power of two */ template - static inline T _align_mask(T align) { - return ~(((T)1 << align) - 1); } + static constexpr T _align_mask(T align) { + return ~(((T)1 << align) - (T)1); } template - static inline T _align_offset(T align) { - return ((T)1 << align) - 1; } + static constexpr T _align_offset(T align) { + return ((T)1 << align) - (T)1; } template - static inline T align_addr(T addr, int align) { + static constexpr T align_addr(T addr, int align) { return (addr + _align_offset((T)align)) & _align_mask((T)align); }