Skip to content

Commit

Permalink
Locally disable a bogus warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Kormanyos committed Jun 10, 2024
1 parent 0c07ce0 commit 9b903c4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion math/wide_decimal/decwide_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,10 @@
// TBD: Need to properly handle this left shift amount
// when GCC's __float128 is active (in case of -std=gnu++XX).
// This happens when native_float_type is of type __float128.

static_assert(std::numeric_limits<native_float_type>::digits <= std::numeric_limits<long double>::digits,
"Error: The instantiated native float type does not fit in long double");

constexpr auto max_left_shift_amount =
static_cast<int>
(
Expand All @@ -676,7 +680,17 @@
: std::numeric_limits<long double>::digits
);

my_mantissa_part |= static_cast<std::uintmax_t>(UINTMAX_C(1) << static_cast<unsigned>(max_left_shift_amount - 1)); // NOLINT(google-runtime-int)
#if (defined(__GNUC__) && !defined(__clang__))
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshift-count-overflow"
#endif

my_mantissa_part |= static_cast<std::uintmax_t>(UINTMAX_C(1) << static_cast<unsigned>(max_left_shift_amount - 1));

#if (defined(__GNUC__) && !defined(__clang__))
#pragma GCC diagnostic pop
#endif

my_exponent_part -= 1;
}

Expand Down

0 comments on commit 9b903c4

Please sign in to comment.