Skip to content

Commit

Permalink
Merge pull request #116 from ckormanyos/more_syntax
Browse files Browse the repository at this point in the history
Handle CodeSonar syntax issues
  • Loading branch information
ckormanyos authored Jan 14, 2024
2 parents d6c4ca6 + 6340d73 commit b35ccb3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
17 changes: 7 additions & 10 deletions math/wide_decimal/decwide_t_detail.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@
static_cast<std::uint32_t>(UINT32_C(2097152))
};

const std::uint32_t* it = util::lower_bound_unsafe(std::begin(a029750_data), std::end(a029750_data), value);
const auto* p_elem = util::lower_bound_unsafe(std::begin(a029750_data), std::end(a029750_data), value);

const auto result =
static_cast<std::uint32_t>
(
(it != std::end(a029750_data))
? *it
(p_elem != std::end(a029750_data))
? *p_elem
: *(std::end(a029750_data) - static_cast<std::size_t>(UINT8_C(1))) // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
);

Expand Down Expand Up @@ -241,7 +241,9 @@

constexpr auto pow10_maker_as_runtime_value(std::uint32_t n) noexcept -> std::uint32_t
{
constexpr std::uint32_t local_p10_table[static_cast<std::size_t>(UINT8_C(10))] = // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
using local_p10_data_array_type = std::array<std::uint32_t, static_cast<std::size_t>(UINT8_C(10))>;

constexpr local_p10_data_array_type local_p10_data = // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
{
static_cast<std::uint32_t>(UINT32_C(1)),
static_cast<std::uint32_t>(UINT32_C(10)),
Expand All @@ -255,12 +257,7 @@
static_cast<std::uint32_t>(UINT32_C(1000000000))
};

const std::uint32_t result =
(
(n < static_cast<std::uint32_t>(sizeof(local_p10_table) / sizeof(local_p10_table[static_cast<std::size_t>(UINT8_C(0))])))
? local_p10_table[static_cast<std::size_t>(n)] // NOLINT(cppcoreguidelines-pro-bounds-constant-array-index)
: *(std::end(local_p10_table) - static_cast<std::size_t>(UINT8_C(1))) // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
);
const auto result = (static_cast<std::size_t>(n) < std::tuple_size<local_p10_data_array_type>::value) ? local_p10_data[static_cast<std::size_t>(n)] : local_p10_data.back();

return result;
}
Expand Down
2 changes: 2 additions & 0 deletions soft_double.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
<ClInclude Include="test\test_soft_double_examples.h" />
<ClInclude Include="util\memory\util_n_slot_array_allocator.h" />
<ClInclude Include="util\utility\util_baselexical_cast.h" />
<ClInclude Include="util\utility\util_constexpr_algorithm_unsafe.h" />
<ClInclude Include="util\utility\util_constexpr_cmath_unsafe.h" />
<ClInclude Include="util\utility\util_dynamic_array.h" />
<ClInclude Include="util\utility\util_noncopyable.h" />
<ClInclude Include="util\utility\util_pseudorandom_time_point_seed.h" />
Expand Down
6 changes: 6 additions & 0 deletions soft_double.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@
<ClInclude Include="util\utility\util_pseudorandom_time_point_seed.h">
<Filter>util\utility</Filter>
</ClInclude>
<ClInclude Include="util\utility\util_constexpr_algorithm_unsafe.h">
<Filter>util\utility</Filter>
</ClInclude>
<ClInclude Include="util\utility\util_constexpr_cmath_unsafe.h">
<Filter>util\utility</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include=".github\workflows\soft_double.yml">
Expand Down

0 comments on commit b35ccb3

Please sign in to comment.