// SPDX-License-Identifier: CC0-1.0 #pragma once #include #include namespace Common { template constexpr T AlignDown(T value, size_t size) { static_assert(std::is_unsigned(), "T must be an unsigned value."); return static_cast(value - value % size); } template constexpr T AlignUp(T value, size_t size) { static_assert(std::is_unsigned(), "T must be an unsigned value."); return AlignDown(static_cast(value + (size - 1)), size); } } // namespace Common