Skip to content

Commit

Permalink
Avoid checking unsigned values for negativity
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Dec 2, 2024
1 parent 9f8e379 commit d74285c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cub/cub/detail/fast_modulo_division.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,14 @@ multiply_extract_higher_bits(T value, R multiplier)
{
static_assert(supported_integral<T>::value, "unsupported type");
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_DIAG_POP
_CCCL_IF_CONSTEXPR (_CCCL_TRAIT(is_signed, T))
{
_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_DIAG_POP
}
static constexpr int NumBits = sizeof(DivisorType) * CHAR_BIT;
using unsigned_t = unsigned_implicit_prom_t<DivisorType>;
using larger_t = larger_unsigned_type_t<DivisorType>;
Expand Down

0 comments on commit d74285c

Please sign in to comment.