From 266107f57c3b2e37d16ba1c2e343e50e70cbe70e Mon Sep 17 00:00:00 2001 From: jstaahl Date: Tue, 6 Apr 2021 22:07:01 -0700 Subject: [PATCH] constexpr uint128_wrapper (#2215) * constexpr uint128_wrapper * change FMT_CONSTEXPR to constexpr * clang format Co-authored-by: Jake Staahl --- include/fmt/format.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 9031f856..890ecb16 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -901,14 +901,16 @@ struct FMT_EXTERN_TEMPLATE_API uint128_wrapper { #if FMT_USE_INT128 uint128_t internal_; - uint128_wrapper(uint64_t high, uint64_t low) FMT_NOEXCEPT + constexpr uint128_wrapper(uint64_t high, uint64_t low) FMT_NOEXCEPT : internal_{static_cast(low) | (static_cast(high) << 64)} {} - uint128_wrapper(uint128_t u) : internal_{u} {} + constexpr uint128_wrapper(uint128_t u) : internal_{u} {} - uint64_t high() const FMT_NOEXCEPT { return uint64_t(internal_ >> 64); } - uint64_t low() const FMT_NOEXCEPT { return uint64_t(internal_); } + constexpr uint64_t high() const FMT_NOEXCEPT { + return uint64_t(internal_ >> 64); + } + constexpr uint64_t low() const FMT_NOEXCEPT { return uint64_t(internal_); } uint128_wrapper& operator+=(uint64_t n) FMT_NOEXCEPT { internal_ += n; @@ -918,11 +920,12 @@ struct FMT_EXTERN_TEMPLATE_API uint128_wrapper { uint64_t high_; uint64_t low_; - uint128_wrapper(uint64_t high, uint64_t low) FMT_NOEXCEPT : high_{high}, - low_{low} {} + constexpr uint128_wrapper(uint64_t high, uint64_t low) FMT_NOEXCEPT + : high_{high}, + low_{low} {} - uint64_t high() const FMT_NOEXCEPT { return high_; } - uint64_t low() const FMT_NOEXCEPT { return low_; } + constexpr uint64_t high() const FMT_NOEXCEPT { return high_; } + constexpr uint64_t low() const FMT_NOEXCEPT { return low_; } uint128_wrapper& operator+=(uint64_t n) FMT_NOEXCEPT { # if defined(_MSC_VER) && defined(_M_X64)