Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid checking unsigned values for negativity #2997

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions cub/cub/detail/fast_modulo_division.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,14 @@ multiply_extract_higher_bits(T value, R multiplier)
static_assert(supported_integral<R>::value, "unsupported type");
_CCCL_DIAG_PUSH
_CCCL_DIAG_SUPPRESS_ICC(186) // pointless comparison of unsigned integer with zero
_CCCL_ASSERT(value >= 0, "value must be non-negative");
_CCCL_ASSERT(multiplier >= 0, "multiplier must be non-negative");
_CCCL_IF_CONSTEXPR (_CCCL_TRAIT(::cuda::std::is_signed, T))
{
_CCCL_ASSERT(value >= 0, "value must be non-negative");
}
_CCCL_IF_CONSTEXPR (_CCCL_TRAIT(::cuda::std::is_signed, R))
{
_CCCL_ASSERT(multiplier >= 0, "multiplier must be non-negative");
}
_CCCL_DIAG_POP
static constexpr int NumBits = sizeof(DivisorType) * CHAR_BIT;
using unsigned_t = unsigned_implicit_prom_t<DivisorType>;
Expand Down
Loading