Skip to content

Commit

Permalink
Fix a couple return type mismatches reported by clang-tidy.
Browse files Browse the repository at this point in the history
  • Loading branch information
greg7mdp committed Apr 15, 2023
1 parent d2bed96 commit 3a4f398
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions parallel_hashmap/phmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ constexpr bool IsNoThrowSwappable(std::false_type /* is_swappable */) {

// --------------------------------------------------------------------------
template <typename T>
int TrailingZeros(T x) {
uint32_t TrailingZeros(T x) {
PHMAP_IF_CONSTEXPR(sizeof(T) == 8)
return base_internal::CountTrailingZerosNonZero64(static_cast<uint64_t>(x));
else
Expand All @@ -214,7 +214,7 @@ int TrailingZeros(T x) {

// --------------------------------------------------------------------------
template <typename T>
int LeadingZeros(T x) {
uint32_t LeadingZeros(T x) {
PHMAP_IF_CONSTEXPR(sizeof(T) == 8)
return base_internal::CountLeadingZeros64(static_cast<uint64_t>(x));
else
Expand Down Expand Up @@ -357,7 +357,7 @@ inline size_t H1(size_t hashval, const ctrl_t* ) {
#endif


inline h2_t H2(size_t hashval) { return (ctrl_t)(hashval & 0x7F); }
inline h2_t H2(size_t hashval) { return (h2_t)(ctrl_t)(hashval & 0x7F); }

inline bool IsEmpty(ctrl_t c) { return c == kEmpty; }
inline bool IsFull(ctrl_t c) { return c >= static_cast<ctrl_t>(0); }
Expand Down Expand Up @@ -963,7 +963,7 @@ class raw_hash_set
return tmp;
}

#if PHMAP_BIDIRECTIONAL
#if 0 // PHMAP_BIDIRECTIONAL
// PRECONDITION: not a begin() iterator.
iterator& operator--() {
assert(ctrl_);
Expand Down Expand Up @@ -1248,7 +1248,7 @@ class raw_hash_set
}
iterator end()
{
#if PHMAP_BIDIRECTIONAL
#if 0 // PHMAP_BIDIRECTIONAL
return iterator_at(capacity_);
#else
return {ctrl_ + capacity_};
Expand Down
4 changes: 2 additions & 2 deletions parallel_hashmap/phmap_bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ inline void UnalignedStore64(void *p, uint64_t v) { memcpy(p, &v, sizeof v); }
namespace phmap {
namespace base_internal {

PHMAP_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros64Slow(uint64_t n) {
PHMAP_BASE_INTERNAL_FORCEINLINE uint32_t CountLeadingZeros64Slow(uint64_t n) {
int zeroes = 60;
if (n >> 32) zeroes -= 32, n >>= 32;
if (n >> 16) zeroes -= 16, n >>= 16;
Expand All @@ -279,7 +279,7 @@ PHMAP_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros64Slow(uint64_t n) {
return "\4\3\2\2\1\1\1\1\0\0\0\0\0\0\0"[n] + zeroes;
}

PHMAP_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros64(uint64_t n) {
PHMAP_BASE_INTERNAL_FORCEINLINE uint32_t CountLeadingZeros64(uint64_t n) {
#if defined(_MSC_VER) && defined(_M_X64)
// MSVC does not have __buitin_clzll. Use _BitScanReverse64.
unsigned long result = 0; // NOLINT(runtime/int)
Expand Down

0 comments on commit 3a4f398

Please sign in to comment.