Skip to content

Commit 3a4f398

Browse files
committed
Fix a couple return type mismatches reported by clang-tidy.
1 parent d2bed96 commit 3a4f398

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

parallel_hashmap/phmap.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ constexpr bool IsNoThrowSwappable(std::false_type /* is_swappable */) {
205205

206206
// --------------------------------------------------------------------------
207207
template <typename T>
208-
int TrailingZeros(T x) {
208+
uint32_t TrailingZeros(T x) {
209209
PHMAP_IF_CONSTEXPR(sizeof(T) == 8)
210210
return base_internal::CountTrailingZerosNonZero64(static_cast<uint64_t>(x));
211211
else
@@ -214,7 +214,7 @@ int TrailingZeros(T x) {
214214

215215
// --------------------------------------------------------------------------
216216
template <typename T>
217-
int LeadingZeros(T x) {
217+
uint32_t LeadingZeros(T x) {
218218
PHMAP_IF_CONSTEXPR(sizeof(T) == 8)
219219
return base_internal::CountLeadingZeros64(static_cast<uint64_t>(x));
220220
else
@@ -357,7 +357,7 @@ inline size_t H1(size_t hashval, const ctrl_t* ) {
357357
#endif
358358

359359

360-
inline h2_t H2(size_t hashval) { return (ctrl_t)(hashval & 0x7F); }
360+
inline h2_t H2(size_t hashval) { return (h2_t)(ctrl_t)(hashval & 0x7F); }
361361

362362
inline bool IsEmpty(ctrl_t c) { return c == kEmpty; }
363363
inline bool IsFull(ctrl_t c) { return c >= static_cast<ctrl_t>(0); }
@@ -963,7 +963,7 @@ class raw_hash_set
963963
return tmp;
964964
}
965965

966-
#if PHMAP_BIDIRECTIONAL
966+
#if 0 // PHMAP_BIDIRECTIONAL
967967
// PRECONDITION: not a begin() iterator.
968968
iterator& operator--() {
969969
assert(ctrl_);
@@ -1248,7 +1248,7 @@ class raw_hash_set
12481248
}
12491249
iterator end()
12501250
{
1251-
#if PHMAP_BIDIRECTIONAL
1251+
#if 0 // PHMAP_BIDIRECTIONAL
12521252
return iterator_at(capacity_);
12531253
#else
12541254
return {ctrl_ + capacity_};

parallel_hashmap/phmap_bits.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ inline void UnalignedStore64(void *p, uint64_t v) { memcpy(p, &v, sizeof v); }
270270
namespace phmap {
271271
namespace base_internal {
272272

273-
PHMAP_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros64Slow(uint64_t n) {
273+
PHMAP_BASE_INTERNAL_FORCEINLINE uint32_t CountLeadingZeros64Slow(uint64_t n) {
274274
int zeroes = 60;
275275
if (n >> 32) zeroes -= 32, n >>= 32;
276276
if (n >> 16) zeroes -= 16, n >>= 16;
@@ -279,7 +279,7 @@ PHMAP_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros64Slow(uint64_t n) {
279279
return "\4\3\2\2\1\1\1\1\0\0\0\0\0\0\0"[n] + zeroes;
280280
}
281281

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

0 commit comments

Comments
 (0)