Fix a couple return type mismatches reported by clang-tidy.

This commit is contained in:
greg7mdp
2023-04-15 16:02:43 -04:00
parent d2bed96d29
commit 3a4f3983a1
2 changed files with 7 additions and 7 deletions
+5 -5
View File
@@ -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
@@ -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
@@ -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); }
@@ -963,7 +963,7 @@ public:
return tmp;
}
#if PHMAP_BIDIRECTIONAL
#if 0 // PHMAP_BIDIRECTIONAL
// PRECONDITION: not a begin() iterator.
iterator& operator--() {
assert(ctrl_);
@@ -1248,7 +1248,7 @@ public:
}
iterator end()
{
#if PHMAP_BIDIRECTIONAL
#if 0 // PHMAP_BIDIRECTIONAL
return iterator_at(capacity_);
#else
return {ctrl_ + capacity_};
+2 -2
View File
@@ -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;
@@ -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)