diff options
-rw-r--r-- | absl/hash/internal/hash.h | 12 | ||||
-rw-r--r-- | absl/numeric/int128.h | 58 | ||||
-rw-r--r-- | absl/status/status.cc | 11 |
3 files changed, 29 insertions, 52 deletions
diff --git a/absl/hash/internal/hash.h b/absl/hash/internal/hash.h index e2397968..ef3f3664 100644 --- a/absl/hash/internal/hash.h +++ b/absl/hash/internal/hash.h @@ -411,7 +411,7 @@ AbslHashValue(H hash_state, LongDouble value) { // AbslHashValue() for hashing pointers template <typename H, typename T> - H AbslHashValue(H hash_state, T* ptr) { +H AbslHashValue(H hash_state, T* ptr) { auto v = reinterpret_cast<uintptr_t>(ptr); // Due to alignment, pointers tend to have low bits as zero, and the next few // bits follow a pattern since they are also multiples of some base value. @@ -428,7 +428,7 @@ H AbslHashValue(H hash_state, std::nullptr_t) { // AbslHashValue() for hashing pointers-to-member template <typename H, typename T, typename C> -H AbslHashValue(H hash_state, T C::* ptr) { +H AbslHashValue(H hash_state, T C::*ptr) { auto salient_ptm_size = [](std::size_t n) -> std::size_t { #if defined(_MSC_VER) // Pointers-to-member-function on MSVC consist of one pointer plus 0, 1, 2, @@ -446,8 +446,8 @@ H AbslHashValue(H hash_state, T C::* ptr) { return n == 24 ? 20 : n == 16 ? 12 : n; } #else - // On other platforms, we assume that pointers-to-members do not have - // padding. + // On other platforms, we assume that pointers-to-members do not have + // padding. #ifdef __cpp_lib_has_unique_object_representations static_assert(std::has_unique_object_representations<T C::*>::value); #endif // __cpp_lib_has_unique_object_representations @@ -955,8 +955,8 @@ class ABSL_DLL MixingHashState : public HashStateBase<MixingHashState> { #endif // ABSL_HAVE_INTRINSIC_INT128 static constexpr uint64_t kMul = - sizeof(size_t) == 4 ? uint64_t{0xcc9e2d51} - : uint64_t{0x9ddfea08eb382d69}; + sizeof(size_t) == 4 ? uint64_t{0xcc9e2d51} + : uint64_t{0x9ddfea08eb382d69}; template <typename T> using IntegralFastPath = diff --git a/absl/numeric/int128.h b/absl/numeric/int128.h index 7a899eec..aa0f86f7 100644 --- a/absl/numeric/int128.h +++ b/absl/numeric/int128.h @@ -119,8 +119,8 @@ class #ifdef ABSL_HAVE_INTRINSIC_INT128 constexpr uint128(__int128 v); // NOLINT(runtime/explicit) constexpr uint128(unsigned __int128 v); // NOLINT(runtime/explicit) -#endif // ABSL_HAVE_INTRINSIC_INT128 - constexpr uint128(int128 v); // NOLINT(runtime/explicit) +#endif // ABSL_HAVE_INTRINSIC_INT128 + constexpr uint128(int128 v); // NOLINT(runtime/explicit) explicit uint128(float v); explicit uint128(double v); explicit uint128(long double v); @@ -286,9 +286,9 @@ class numeric_limits<absl::uint128> { #endif // ABSL_HAVE_INTRINSIC_INT128 static constexpr bool tinyness_before = false; - static constexpr absl::uint128 (min)() { return 0; } + static constexpr absl::uint128(min)() { return 0; } static constexpr absl::uint128 lowest() { return 0; } - static constexpr absl::uint128 (max)() { return absl::Uint128Max(); } + static constexpr absl::uint128(max)() { return absl::Uint128Max(); } static constexpr absl::uint128 epsilon() { return 0; } static constexpr absl::uint128 round_error() { return 0; } static constexpr absl::uint128 infinity() { return 0; } @@ -521,9 +521,9 @@ class numeric_limits<absl::int128> { #endif // ABSL_HAVE_INTRINSIC_INT128 static constexpr bool tinyness_before = false; - static constexpr absl::int128 (min)() { return absl::Int128Min(); } + static constexpr absl::int128(min)() { return absl::Int128Min(); } static constexpr absl::int128 lowest() { return absl::Int128Min(); } - static constexpr absl::int128 (max)() { return absl::Int128Max(); } + static constexpr absl::int128(max)() { return absl::Int128Max(); } static constexpr absl::int128 epsilon() { return 0; } static constexpr absl::int128 round_error() { return 0; } static constexpr absl::int128 infinity() { return 0; } @@ -561,9 +561,7 @@ inline uint128& uint128::operator=(unsigned long v) { } // NOLINTNEXTLINE(runtime/int) -inline uint128& uint128::operator=(long long v) { - return *this = uint128(v); -} +inline uint128& uint128::operator=(long long v) { return *this = uint128(v); } // NOLINTNEXTLINE(runtime/int) inline uint128& uint128::operator=(unsigned long long v) { @@ -571,18 +569,14 @@ inline uint128& uint128::operator=(unsigned long long v) { } #ifdef ABSL_HAVE_INTRINSIC_INT128 -inline uint128& uint128::operator=(__int128 v) { - return *this = uint128(v); -} +inline uint128& uint128::operator=(__int128 v) { return *this = uint128(v); } inline uint128& uint128::operator=(unsigned __int128 v) { return *this = uint128(v); } #endif // ABSL_HAVE_INTRINSIC_INT128 -inline uint128& uint128::operator=(int128 v) { - return *this = uint128(v); -} +inline uint128& uint128::operator=(int128 v) { return *this = uint128(v); } // Arithmetic operators. @@ -637,8 +631,7 @@ constexpr uint64_t Uint128High64(uint128 v) { return v.hi_; } #if defined(ABSL_IS_LITTLE_ENDIAN) -constexpr uint128::uint128(uint64_t high, uint64_t low) - : lo_{low}, hi_{high} {} +constexpr uint128::uint128(uint64_t high, uint64_t low) : lo_{low}, hi_{high} {} constexpr uint128::uint128(int v) : lo_{static_cast<uint64_t>(v)}, @@ -670,8 +663,7 @@ constexpr uint128::uint128(int128 v) #elif defined(ABSL_IS_BIG_ENDIAN) -constexpr uint128::uint128(uint64_t high, uint64_t low) - : hi_{high}, lo_{low} {} +constexpr uint128::uint128(uint64_t high, uint64_t low) : hi_{high}, lo_{low} {} constexpr uint128::uint128(int v) : hi_{v < 0 ? (std::numeric_limits<uint64_t>::max)() : 0}, @@ -817,13 +809,9 @@ constexpr bool operator>=(uint128 lhs, uint128 rhs) { return !(lhs < rhs); } // Unary operators. -constexpr inline uint128 operator+(uint128 val) { - return val; -} +constexpr inline uint128 operator+(uint128 val) { return val; } -constexpr inline int128 operator+(int128 val) { - return val; -} +constexpr inline int128 operator+(int128 val) { return val; } constexpr uint128 operator-(uint128 val) { #if defined(ABSL_HAVE_INTRINSIC_INT128) @@ -906,7 +894,7 @@ constexpr uint128 operator<<(uint128 lhs, int amount) { #else // uint64_t shifts of >= 64 are undefined, so we will need some // special-casing. - return amount >= 64 ? MakeUint128(Uint128Low64(lhs) << (amount - 64), 0) + return amount >= 64 ? MakeUint128(Uint128Low64(lhs) << (amount - 64), 0) : amount == 0 ? lhs : MakeUint128((Uint128High64(lhs) << amount) | (Uint128Low64(lhs) >> (64 - amount)), @@ -920,7 +908,7 @@ constexpr uint128 operator>>(uint128 lhs, int amount) { #else // uint64_t shifts of >= 64 are undefined, so we will need some // special-casing. - return amount >= 64 ? MakeUint128(0, Uint128High64(lhs) >> (amount - 64)) + return amount >= 64 ? MakeUint128(0, Uint128High64(lhs) >> (amount - 64)) : amount == 0 ? lhs : MakeUint128(Uint128High64(lhs) >> amount, (Uint128Low64(lhs) >> amount) | @@ -1042,27 +1030,19 @@ constexpr int128 MakeInt128(int64_t high, uint64_t low) { } // Assignment from integer types. -inline int128& int128::operator=(int v) { - return *this = int128(v); -} +inline int128& int128::operator=(int v) { return *this = int128(v); } -inline int128& int128::operator=(unsigned int v) { - return *this = int128(v); -} +inline int128& int128::operator=(unsigned int v) { return *this = int128(v); } inline int128& int128::operator=(long v) { // NOLINT(runtime/int) return *this = int128(v); } // NOLINTNEXTLINE(runtime/int) -inline int128& int128::operator=(unsigned long v) { - return *this = int128(v); -} +inline int128& int128::operator=(unsigned long v) { return *this = int128(v); } // NOLINTNEXTLINE(runtime/int) -inline int128& int128::operator=(long long v) { - return *this = int128(v); -} +inline int128& int128::operator=(long long v) { return *this = int128(v); } // NOLINTNEXTLINE(runtime/int) inline int128& int128::operator=(unsigned long long v) { diff --git a/absl/status/status.cc b/absl/status/status.cc index 160eb417..d011075a 100644 --- a/absl/status/status.cc +++ b/absl/status/status.cc @@ -80,10 +80,8 @@ std::ostream& operator<<(std::ostream& os, StatusCode code) { namespace status_internal { static absl::optional<size_t> FindPayloadIndexByUrl( - const Payloads* payloads, - absl::string_view type_url) { - if (payloads == nullptr) - return absl::nullopt; + const Payloads* payloads, absl::string_view type_url) { + if (payloads == nullptr) return absl::nullopt; for (size_t i = 0; i < payloads->size(); ++i) { if ((*payloads)[i].type_url == type_url) return i; @@ -125,8 +123,7 @@ absl::optional<absl::Cord> Status::GetPayload( const auto* payloads = GetPayloads(); absl::optional<size_t> index = status_internal::FindPayloadIndexByUrl(payloads, type_url); - if (index.has_value()) - return (*payloads)[index.value()].payload; + if (index.has_value()) return (*payloads)[index.value()].payload; return absl::nullopt; } @@ -303,7 +300,7 @@ std::string Status::ToStringSlow(StatusToStringMode mode) const { absl::StrAppend(&text, absl::StatusCodeToString(code()), ": ", message()); const bool with_payload = (mode & StatusToStringMode::kWithPayload) == - StatusToStringMode::kWithPayload; + StatusToStringMode::kWithPayload; if (with_payload) { status_internal::StatusPayloadPrinter printer = |