From 73666fb2622a5f6a7ab9f92c9a46ce2e215c4e83 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Fri, 24 Sep 2021 01:21:07 -0400 Subject: general: Update style to clang-format-12 --- src/common/alignment.h | 21 ++++++++++++++------- src/common/div_ceil.h | 8 ++++---- src/common/intrusive_red_black_tree.h | 17 ++++++++--------- src/common/vector_math.h | 4 ++-- 4 files changed, 28 insertions(+), 22 deletions(-) (limited to 'src/common') diff --git a/src/common/alignment.h b/src/common/alignment.h index 32d796ffa..1b56569d1 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h @@ -9,41 +9,48 @@ namespace Common { template -requires std::is_unsigned_v[[nodiscard]] constexpr T AlignUp(T value, size_t size) { +requires std::is_unsigned_v +[[nodiscard]] constexpr T AlignUp(T value, size_t size) { auto mod{static_cast(value % size)}; value -= mod; return static_cast(mod == T{0} ? value : value + size); } template -requires std::is_unsigned_v[[nodiscard]] constexpr T AlignUpLog2(T value, size_t align_log2) { +requires std::is_unsigned_v +[[nodiscard]] constexpr T AlignUpLog2(T value, size_t align_log2) { return static_cast((value + ((1ULL << align_log2) - 1)) >> align_log2 << align_log2); } template -requires std::is_unsigned_v[[nodiscard]] constexpr T AlignDown(T value, size_t size) { +requires std::is_unsigned_v +[[nodiscard]] constexpr T AlignDown(T value, size_t size) { return static_cast(value - value % size); } template -requires std::is_unsigned_v[[nodiscard]] constexpr bool Is4KBAligned(T value) { +requires std::is_unsigned_v +[[nodiscard]] constexpr bool Is4KBAligned(T value) { return (value & 0xFFF) == 0; } template -requires std::is_unsigned_v[[nodiscard]] constexpr bool IsWordAligned(T value) { +requires std::is_unsigned_v +[[nodiscard]] constexpr bool IsWordAligned(T value) { return (value & 0b11) == 0; } template -requires std::is_integral_v[[nodiscard]] constexpr bool IsAligned(T value, size_t alignment) { +requires std::is_integral_v +[[nodiscard]] constexpr bool IsAligned(T value, size_t alignment) { using U = typename std::make_unsigned_t; const U mask = static_cast(alignment - 1); return (value & mask) == 0; } template -requires std::is_integral_v[[nodiscard]] constexpr T DivideUp(T x, U y) { +requires std::is_integral_v +[[nodiscard]] constexpr T DivideUp(T x, U y) { return (x + (y - 1)) / y; } diff --git a/src/common/div_ceil.h b/src/common/div_ceil.h index 95e1489a9..e1db35464 100644 --- a/src/common/div_ceil.h +++ b/src/common/div_ceil.h @@ -11,15 +11,15 @@ namespace Common { /// Ceiled integer division. template -requires std::is_integral_v&& std::is_unsigned_v[[nodiscard]] constexpr N DivCeil(N number, - D divisor) { +requires std::is_integral_v && std::is_unsigned_v +[[nodiscard]] constexpr N DivCeil(N number, D divisor) { return static_cast((static_cast(number) + divisor - 1) / divisor); } /// Ceiled integer division with logarithmic divisor in base 2 template -requires std::is_integral_v&& std::is_unsigned_v[[nodiscard]] constexpr N DivCeilLog2( - N value, D alignment_log2) { +requires std::is_integral_v && std::is_unsigned_v +[[nodiscard]] constexpr N DivCeilLog2(N value, D alignment_log2) { return static_cast((static_cast(value) + (D(1) << alignment_log2) - 1) >> alignment_log2); } diff --git a/src/common/intrusive_red_black_tree.h b/src/common/intrusive_red_black_tree.h index 1f696fe80..3173cc449 100644 --- a/src/common/intrusive_red_black_tree.h +++ b/src/common/intrusive_red_black_tree.h @@ -235,20 +235,19 @@ public: template concept HasLightCompareType = requires { - { std::is_same::value } - ->std::convertible_to; + { std::is_same::value } -> std::convertible_to; }; namespace impl { -template -consteval auto* GetLightCompareType() { - if constexpr (HasLightCompareType) { - return static_cast(nullptr); - } else { - return static_cast(nullptr); + template + consteval auto* GetLightCompareType() { + if constexpr (HasLightCompareType) { + return static_cast(nullptr); + } else { + return static_cast(nullptr); + } } -} } // namespace impl diff --git a/src/common/vector_math.h b/src/common/vector_math.h index 22dba3c2d..ba7c363c1 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h @@ -667,8 +667,8 @@ template // linear interpolation via float: 0.0=begin, 1.0=end template -[[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{}) Lerp(const X& begin, const X& end, - const float t) { +[[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{}) + Lerp(const X& begin, const X& end, const float t) { return begin * (1.f - t) + end * t; } -- cgit v1.2.3