Skip to content

Commit

Permalink
fix clang tidy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
KRM7 committed Mar 29, 2024
1 parent 70113c9 commit 192edb6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/utility/bit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace gapp::detail
template<std::unsigned_integral T>
constexpr T to_mask(bool value) noexcept
{
return static_cast<T>(-1 * static_cast<int>(value));
return static_cast<T>(-1 * static_cast<int>(value)); // NOLINT(*widening-cast)
}

} // namespace gapp::detail
Expand Down
8 changes: 6 additions & 2 deletions src/utility/dynamic_bitset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <cstdint>
#include <cstddef>

// NOLINTBEGIN(*bool-conversion, *assignment, *operator)

namespace gapp::detail
{
class dynamic_bitset
Expand Down Expand Up @@ -205,12 +207,12 @@ namespace gapp::detail
{
if (lhs.size_ != rhs.size_) return false;

for (std::size_t i = 0; i < lhs.size_ / lhs.block_size; i++)
for (std::size_t i = 0; i < lhs.size_ / dynamic_bitset::block_size; i++)
{
if (lhs.blocks_[i] != rhs.blocks_[i]) return false;
}

if (std::size_t rem_size = lhs.size_ % lhs.block_size; rem_size)
if (std::size_t rem_size = lhs.size_ % dynamic_bitset::block_size; rem_size)
{
auto rem_mask = ones_right_n<typename dynamic_bitset::block_type>(rem_size);
auto lhs_rem_block = lhs.blocks_.back() & rem_mask;
Expand Down Expand Up @@ -247,4 +249,6 @@ namespace gapp::detail

} // namespace gapp::detail

// NOLINTEND(*bool-conversion, *assignment, *operator)

#endif // !GAPP_UTILITY_DYNAMIC_BITSET_HPP
6 changes: 2 additions & 4 deletions src/utility/rng.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,8 @@ namespace gapp::rng
{
return std::distance(cdf.begin(), std::find_if(cdf.begin(), cdf.end(), detail::greater_eq_than(threshold)));
}
else
{
return std::distance(cdf.begin(), std::lower_bound(cdf.begin(), cdf.end(), threshold));
}

return std::distance(cdf.begin(), std::lower_bound(cdf.begin(), cdf.end(), threshold));
}

} // namespace gapp::rng
Expand Down
8 changes: 4 additions & 4 deletions src/utility/small_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <cstdlib>
#include <cstddef>

// NOLINTBEGIN(*pointer-arithmetic)
// NOLINTBEGIN(*pointer-arithmetic, *union-access)

namespace gapp::detail
{
Expand Down Expand Up @@ -302,8 +302,8 @@ namespace gapp::detail
struct small_vector_buffer
{
public:
constexpr small_vector_buffer() noexcept {};
constexpr ~small_vector_buffer() noexcept {};
constexpr small_vector_buffer() noexcept {}; // NOLINT(*default)
constexpr ~small_vector_buffer() noexcept {}; // NOLINT(*default)

constexpr auto begin() noexcept { return data_.data(); }
constexpr auto begin() const noexcept { return data_.data(); }
Expand Down Expand Up @@ -1076,6 +1076,6 @@ namespace gapp

} // namespace gapp

// NOLINTEND(*pointer-arithmetic)
// NOLINTEND(*pointer-arithmetic, *union-access)

#endif // !GAPP_UTILITY_SMALL_VECTOR_HPP

0 comments on commit 192edb6

Please sign in to comment.