From 860f13cd7e517c7f508ff350cb0f89defe21f2d7 Mon Sep 17 00:00:00 2001 From: apio Date: Fri, 18 Nov 2022 18:02:38 +0100 Subject: [PATCH] Rename align_base to alignment --- luna/Alignment.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/luna/Alignment.h b/luna/Alignment.h index e51af9af..e69c0aad 100644 --- a/luna/Alignment.h +++ b/luna/Alignment.h @@ -1,27 +1,27 @@ #pragma once -template constexpr T is_aligned(T value, T align_base) +template constexpr T is_aligned(T value, T alignment) { - return (value % align_base == 0); + return (value % alignment == 0); } static_assert(is_aligned(1024, 512)); static_assert(!is_aligned(235, 32)); static_assert(is_aligned(40960, 4096)); -template constexpr T align_down(T value, T align_base) +template constexpr T align_down(T value, T alignment) { - return value - (value % align_base); + return value - (value % alignment); } static_assert(align_down(598, 512) == 512); static_assert(align_down(194, 64) == 192); static_assert(align_down(62, 31) == 62); -template constexpr T align_up(T value, T align_base) +template constexpr T align_up(T value, T alignment) { - if (is_aligned(value, align_base)) return value; - return align_down(value, align_base) + align_base; + if (is_aligned(value, alignment)) return value; + return align_down(value, alignment) + alignment; } static_assert(align_up(598, 512) == 1024);