diff options
author | Linus Groh <mail@linusgroh.de> | 2022-10-17 00:06:11 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-12-03 23:52:23 +0000 |
commit | d26aabff0401690d6dd1332558b40f5cb64e4428 (patch) | |
tree | fd56d0ab5b672814a1a2fb7b8a92fefb01f24e6f /AK/StdLibExtras.h | |
parent | 8639d8bc212dcb45aff80405b4b0f6b1ef1087e7 (diff) | |
download | serenity-d26aabff0401690d6dd1332558b40f5cb64e4428.zip |
Everywhere: Run clang-format
Diffstat (limited to 'AK/StdLibExtras.h')
-rw-r--r-- | AK/StdLibExtras.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/AK/StdLibExtras.h b/AK/StdLibExtras.h index dcd1fa8985..d23d283aa2 100644 --- a/AK/StdLibExtras.h +++ b/AK/StdLibExtras.h @@ -17,13 +17,15 @@ #include <AK/Assertions.h> template<typename T, typename U> -constexpr auto round_up_to_power_of_two(T value, U power_of_two) requires(AK::Detail::IsIntegral<T>&& AK::Detail::IsIntegral<U>) +constexpr auto round_up_to_power_of_two(T value, U power_of_two) +requires(AK::Detail::IsIntegral<T> && AK::Detail::IsIntegral<U>) { return ((value - 1) & ~(power_of_two - 1)) + power_of_two; } template<typename T> -constexpr bool is_power_of_two(T value) requires(AK::Detail::IsIntegral<T>) +constexpr bool is_power_of_two(T value) +requires(AK::Detail::IsIntegral<T>) { return value && !((value) & (value - 1)); } @@ -81,19 +83,19 @@ constexpr SizeType array_size(T (&)[N]) } template<typename T> -constexpr T min(const T& a, IdentityType<T> const& b) +constexpr T min(T const& a, IdentityType<T> const& b) { return b < a ? b : a; } template<typename T> -constexpr T max(const T& a, IdentityType<T> const& b) +constexpr T max(T const& a, IdentityType<T> const& b) { return a < b ? b : a; } template<typename T> -constexpr T clamp(const T& value, IdentityType<T> const& min, IdentityType<T> const& max) +constexpr T clamp(T const& value, IdentityType<T> const& min, IdentityType<T> const& max) { VERIFY(max >= min); if (value > max) @@ -141,7 +143,8 @@ template<typename T> using RawPtr = typename Detail::_RawPtr<T>::Type; template<typename V> -constexpr decltype(auto) to_underlying(V value) requires(IsEnum<V>) +constexpr decltype(auto) to_underlying(V value) +requires(IsEnum<V>) { return static_cast<UnderlyingType<V>>(value); } |