diff --git a/luna/include/luna/Alignment.h b/luna/include/luna/Alignment.h index 90fa632a..02e04d92 100644 --- a/luna/include/luna/Alignment.h +++ b/luna/include/luna/Alignment.h @@ -1,9 +1,10 @@ #pragma once +#include // Must ALWAYS be called with a power of two as alignment. template constexpr T is_aligned(T value) { - static_assert((alignment & (alignment - 1)) == 0); + static_assert(IsPowerOfTwo); return (value % alignment == 0); } @@ -14,7 +15,7 @@ static_assert(is_aligned<4096>(40960u)); // Must ALWAYS be called with a power of two as alignment. template constexpr T align_down(T value) { - static_assert((alignment & (alignment - 1)) == 0); + static_assert(IsPowerOfTwo); return value - value % alignment; }