Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Avoid warnings about unreachable code
Browse files Browse the repository at this point in the history
NVC++ warns about unreachable code in specializations of
BaseDigitExtractor::ProcessFloatMinusZero where FLOAT_KEY is false.
Rearrange the code to avoid the warning, without changing the behavior
at all.
  • Loading branch information
dkolsen-pgi authored and alliepiper committed Jul 21, 2021
1 parent e539681 commit 72ac249
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cub/block/radix_rank_sort_operations.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,14 @@ struct BaseDigitExtractor

static __device__ __forceinline__ UnsignedBits ProcessFloatMinusZero(UnsignedBits key)
{
if (!FLOAT_KEY) return key;

UnsignedBits TWIDDLED_MINUS_ZERO_BITS =
TraitsT::TwiddleIn(UnsignedBits(1) << UnsignedBits(8 * sizeof(UnsignedBits) - 1));
UnsignedBits TWIDDLED_ZERO_BITS = TraitsT::TwiddleIn(0);
return key == TWIDDLED_MINUS_ZERO_BITS ? TWIDDLED_ZERO_BITS : key;
if (!FLOAT_KEY) {
return key;
} else {
UnsignedBits TWIDDLED_MINUS_ZERO_BITS =
TraitsT::TwiddleIn(UnsignedBits(1) << UnsignedBits(8 * sizeof(UnsignedBits) - 1));
UnsignedBits TWIDDLED_ZERO_BITS = TraitsT::TwiddleIn(0);
return key == TWIDDLED_MINUS_ZERO_BITS ? TWIDDLED_ZERO_BITS : key;
}
}
};

Expand Down

0 comments on commit 72ac249

Please sign in to comment.