Skip to content

Commit

Permalink
Avoid nvcc unreachable warning
Browse files Browse the repository at this point in the history
  • Loading branch information
greg7mdp committed Sep 21, 2024
1 parent f714be4 commit 44ff8b5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions include/gtl/phmap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,19 +712,23 @@ struct IsDecomposable<std::void_t<decltype(Policy::apply(RequireUsableKey<typena
// --------------------------------------------------------------------------
template<typename T>
uint32_t TrailingZeros(T x) {
uint32_t res;
if constexpr (sizeof(T) == 8)
return gtl::CountTrailingZerosNonZero64(static_cast<uint64_t>(x));
res = gtl::CountTrailingZerosNonZero64(static_cast<uint64_t>(x));
else
return gtl::CountTrailingZerosNonZero32(static_cast<uint32_t>(x));
res = gtl::CountTrailingZerosNonZero32(static_cast<uint32_t>(x));
return res;
}

// --------------------------------------------------------------------------
template<typename T>
uint32_t LeadingZeros(T x) {
uint32_t res;
if constexpr (sizeof(T) == 8)
return gtl::CountLeadingZeros64(static_cast<uint64_t>(x));
res = gtl::CountLeadingZeros64(static_cast<uint64_t>(x));
else
return gtl::CountLeadingZeros32(static_cast<uint32_t>(x));
res = gtl::CountLeadingZeros32(static_cast<uint32_t>(x));
return res;
}

// --------------------------------------------------------------------------
Expand Down Expand Up @@ -909,14 +913,14 @@ struct GroupSse2Impl {
// Returns a bitmask representing the positions of empty or deleted slots.
// -----------------------------------------------------------------------
BitMask<uint32_t, kWidth> MatchEmptyOrDeleted() const {
auto special = _mm_set1_epi8(static_cast<uint8_t>(kSentinel));
auto special = _mm_set1_epi8(static_cast<char>(kSentinel));
return BitMask<uint32_t, kWidth>(static_cast<uint32_t>(_mm_movemask_epi8(_mm_cmpgt_epi8_fixed(special, ctrl))));
}

// Returns the number of trailing empty or deleted elements in the group.
// ----------------------------------------------------------------------
uint32_t CountLeadingEmptyOrDeleted() const {
auto special = _mm_set1_epi8(static_cast<uint8_t>(kSentinel));
auto special = _mm_set1_epi8(static_cast<char>(kSentinel));
return TrailingZeros(static_cast<uint32_t>(_mm_movemask_epi8(_mm_cmpgt_epi8_fixed(special, ctrl)) + 1));
}

Expand Down

0 comments on commit 44ff8b5

Please sign in to comment.