Skip to content

Commit

Permalink
Handle remaining clang-tidy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ckormanyos committed Oct 12, 2024
1 parent 8104e86 commit 8103f57
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/wide_decimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ jobs:
echo "make prepare -f make_tidy_01_generic.gmk MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}"
echo
make prepare -f make_tidy_01_generic.gmk MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}
echo "make tidy -f make_tidy_01_generic.gmk --jobs=8 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}"
make tidy -f make_tidy_01_generic.gmk --jobs=8 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}
echo "make tidy -f make_tidy_01_generic.gmk --jobs=12 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}"
make tidy -f make_tidy_01_generic.gmk --jobs=12 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}
echo
echo "verify empty word count of ./tmp/all.tidy_txt"
wc ./tmp/all.tidy_txt | grep '0 0 0'
Expand Down
36 changes: 20 additions & 16 deletions math/wide_decimal/decwide_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -4382,9 +4382,10 @@
using local_flags_type = std::ios::fmtflags;

// Assess the format flags.
// Obtain the showpos flag.
const auto my_showpos = (static_cast<local_flags_type>(ostrm_flags & std::ios::showpos) != static_cast<local_flags_type>(UINT8_C(0)));
const auto my_uppercase = (static_cast<local_flags_type>(ostrm_flags & std::ios::uppercase) != static_cast<local_flags_type>(UINT8_C(0)));

// Obtain the showpos and uppercase flags.
const bool my_showpos { static_cast<local_flags_type>(ostrm_flags & std::ios::showpos) == static_cast<local_flags_type>(std::ios::showpos) };
const bool my_uppercase { static_cast<local_flags_type>(ostrm_flags & std::ios::uppercase) == static_cast<local_flags_type>(std::ios::uppercase) };

using std::ilogb;

Expand All @@ -4396,24 +4397,27 @@

if (static_cast<local_flags_type>(ostrm_flags & std::ios::scientific) == static_cast<local_flags_type>(std::ios::scientific)) { my_float_field = detail::os_float_field_type::scientific; }
else if(static_cast<local_flags_type>(ostrm_flags & std::ios::fixed) == static_cast<local_flags_type>(std::ios::fixed)) { my_float_field = detail::os_float_field_type::fixed; }
else { my_float_field = detail::os_float_field_type::none; }
else { my_float_field = detail::os_float_field_type::none; }

// Get the output stream's precision and limit it to max_digits10.
// Erroneous negative precision (theoretically impossible) will be
// set to ostream's default precision. Zero precision will be left
// at zero.
const auto prec_default = static_cast<std::streamsize>(INT8_C(6));

auto os_precision =
static_cast<std::uint_fast32_t>
(
((ostrm_precision <= static_cast<std::streamsize>(0))
? ((my_float_field != detail::os_float_field_type::scientific) ? static_cast<std::uint_fast32_t>(prec_default) : static_cast<std::uint_fast32_t>(UINT8_C(0)))
: static_cast<std::uint_fast32_t>(ostrm_precision))
);
std::uint_fast32_t
os_precision
{
static_cast<std::uint_fast32_t>
(
((ostrm_precision <= static_cast<std::streamsize>(0))
? ((my_float_field != detail::os_float_field_type::scientific) ? static_cast<std::uint_fast32_t>(prec_default) : static_cast<std::uint_fast32_t>(UINT8_C(0)))
: static_cast<std::uint_fast32_t>(ostrm_precision))
)
};

auto use_scientific = false;
auto use_fixed = false;
bool use_scientific { false };
bool use_fixed { false };

if (my_float_field == detail::os_float_field_type::scientific) { use_scientific = true; }
else if(my_float_field == detail::os_float_field_type::fixed) { use_fixed = true; }
Expand Down Expand Up @@ -4502,9 +4506,9 @@
// Obtain additional format information.
const bool
my_showpoint
{
static_cast<local_flags_type>(ostrm_flags & std::ios::showpoint) == static_cast<local_flags_type>(std::ios::showpoint)
};
{
static_cast<local_flags_type>(ostrm_flags & std::ios::showpoint) == static_cast<local_flags_type>(std::ios::showpoint)
};

// Write the output string in the desired format.
if (my_float_field == detail::os_float_field_type::scientific) { wr_string_scientific(str, the_exp, os_precision, my_showpoint, my_uppercase); }
Expand Down

0 comments on commit 8103f57

Please sign in to comment.