Commit 65109ecd by Patrick Xia Committed by Copybara-Service

trivial: format some files using clang-format

PiperOrigin-RevId: 527598377
Change-Id: I0ae1505db595b7f3a420f2f608c6e02f8800f138
parent 8518869e
...@@ -411,7 +411,7 @@ AbslHashValue(H hash_state, LongDouble value) { ...@@ -411,7 +411,7 @@ AbslHashValue(H hash_state, LongDouble value) {
// AbslHashValue() for hashing pointers // AbslHashValue() for hashing pointers
template <typename H, typename T> 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); auto v = reinterpret_cast<uintptr_t>(ptr);
// Due to alignment, pointers tend to have low bits as zero, and the next few // 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. // 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) { ...@@ -428,7 +428,7 @@ H AbslHashValue(H hash_state, std::nullptr_t) {
// AbslHashValue() for hashing pointers-to-member // AbslHashValue() for hashing pointers-to-member
template <typename H, typename T, typename C> 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 { auto salient_ptm_size = [](std::size_t n) -> std::size_t {
#if defined(_MSC_VER) #if defined(_MSC_VER)
// Pointers-to-member-function on MSVC consist of one pointer plus 0, 1, 2, // Pointers-to-member-function on MSVC consist of one pointer plus 0, 1, 2,
......
...@@ -286,9 +286,9 @@ class numeric_limits<absl::uint128> { ...@@ -286,9 +286,9 @@ class numeric_limits<absl::uint128> {
#endif // ABSL_HAVE_INTRINSIC_INT128 #endif // ABSL_HAVE_INTRINSIC_INT128
static constexpr bool tinyness_before = false; 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 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 epsilon() { return 0; }
static constexpr absl::uint128 round_error() { return 0; } static constexpr absl::uint128 round_error() { return 0; }
static constexpr absl::uint128 infinity() { return 0; } static constexpr absl::uint128 infinity() { return 0; }
...@@ -521,9 +521,9 @@ class numeric_limits<absl::int128> { ...@@ -521,9 +521,9 @@ class numeric_limits<absl::int128> {
#endif // ABSL_HAVE_INTRINSIC_INT128 #endif // ABSL_HAVE_INTRINSIC_INT128
static constexpr bool tinyness_before = false; 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 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 epsilon() { return 0; }
static constexpr absl::int128 round_error() { return 0; } static constexpr absl::int128 round_error() { return 0; }
static constexpr absl::int128 infinity() { return 0; } static constexpr absl::int128 infinity() { return 0; }
...@@ -561,9 +561,7 @@ inline uint128& uint128::operator=(unsigned long v) { ...@@ -561,9 +561,7 @@ inline uint128& uint128::operator=(unsigned long v) {
} }
// NOLINTNEXTLINE(runtime/int) // NOLINTNEXTLINE(runtime/int)
inline uint128& uint128::operator=(long long v) { inline uint128& uint128::operator=(long long v) { return *this = uint128(v); }
return *this = uint128(v);
}
// NOLINTNEXTLINE(runtime/int) // NOLINTNEXTLINE(runtime/int)
inline uint128& uint128::operator=(unsigned long long v) { inline uint128& uint128::operator=(unsigned long long v) {
...@@ -571,18 +569,14 @@ 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 #ifdef ABSL_HAVE_INTRINSIC_INT128
inline uint128& uint128::operator=(__int128 v) { inline uint128& uint128::operator=(__int128 v) { return *this = uint128(v); }
return *this = uint128(v);
}
inline uint128& uint128::operator=(unsigned __int128 v) { inline uint128& uint128::operator=(unsigned __int128 v) {
return *this = uint128(v); return *this = uint128(v);
} }
#endif // ABSL_HAVE_INTRINSIC_INT128 #endif // ABSL_HAVE_INTRINSIC_INT128
inline uint128& uint128::operator=(int128 v) { inline uint128& uint128::operator=(int128 v) { return *this = uint128(v); }
return *this = uint128(v);
}
// Arithmetic operators. // Arithmetic operators.
...@@ -637,8 +631,7 @@ constexpr uint64_t Uint128High64(uint128 v) { return v.hi_; } ...@@ -637,8 +631,7 @@ constexpr uint64_t Uint128High64(uint128 v) { return v.hi_; }
#if defined(ABSL_IS_LITTLE_ENDIAN) #if defined(ABSL_IS_LITTLE_ENDIAN)
constexpr uint128::uint128(uint64_t high, uint64_t low) constexpr uint128::uint128(uint64_t high, uint64_t low) : lo_{low}, hi_{high} {}
: lo_{low}, hi_{high} {}
constexpr uint128::uint128(int v) constexpr uint128::uint128(int v)
: lo_{static_cast<uint64_t>(v)}, : lo_{static_cast<uint64_t>(v)},
...@@ -670,8 +663,7 @@ constexpr uint128::uint128(int128 v) ...@@ -670,8 +663,7 @@ constexpr uint128::uint128(int128 v)
#elif defined(ABSL_IS_BIG_ENDIAN) #elif defined(ABSL_IS_BIG_ENDIAN)
constexpr uint128::uint128(uint64_t high, uint64_t low) constexpr uint128::uint128(uint64_t high, uint64_t low) : hi_{high}, lo_{low} {}
: hi_{high}, lo_{low} {}
constexpr uint128::uint128(int v) constexpr uint128::uint128(int v)
: hi_{v < 0 ? (std::numeric_limits<uint64_t>::max)() : 0}, : hi_{v < 0 ? (std::numeric_limits<uint64_t>::max)() : 0},
...@@ -817,13 +809,9 @@ constexpr bool operator>=(uint128 lhs, uint128 rhs) { return !(lhs < rhs); } ...@@ -817,13 +809,9 @@ constexpr bool operator>=(uint128 lhs, uint128 rhs) { return !(lhs < rhs); }
// Unary operators. // Unary operators.
constexpr inline uint128 operator+(uint128 val) { constexpr inline uint128 operator+(uint128 val) { return val; }
return val;
}
constexpr inline int128 operator+(int128 val) { constexpr inline int128 operator+(int128 val) { return val; }
return val;
}
constexpr uint128 operator-(uint128 val) { constexpr uint128 operator-(uint128 val) {
#if defined(ABSL_HAVE_INTRINSIC_INT128) #if defined(ABSL_HAVE_INTRINSIC_INT128)
...@@ -1042,27 +1030,19 @@ constexpr int128 MakeInt128(int64_t high, uint64_t low) { ...@@ -1042,27 +1030,19 @@ constexpr int128 MakeInt128(int64_t high, uint64_t low) {
} }
// Assignment from integer types. // Assignment from integer types.
inline int128& int128::operator=(int v) { inline int128& int128::operator=(int v) { return *this = int128(v); }
return *this = int128(v);
}
inline int128& int128::operator=(unsigned int v) { inline int128& int128::operator=(unsigned int v) { return *this = int128(v); }
return *this = int128(v);
}
inline int128& int128::operator=(long v) { // NOLINT(runtime/int) inline int128& int128::operator=(long v) { // NOLINT(runtime/int)
return *this = int128(v); return *this = int128(v);
} }
// NOLINTNEXTLINE(runtime/int) // NOLINTNEXTLINE(runtime/int)
inline int128& int128::operator=(unsigned long v) { inline int128& int128::operator=(unsigned long v) { return *this = int128(v); }
return *this = int128(v);
}
// NOLINTNEXTLINE(runtime/int) // NOLINTNEXTLINE(runtime/int)
inline int128& int128::operator=(long long v) { inline int128& int128::operator=(long long v) { return *this = int128(v); }
return *this = int128(v);
}
// NOLINTNEXTLINE(runtime/int) // NOLINTNEXTLINE(runtime/int)
inline int128& int128::operator=(unsigned long long v) { inline int128& int128::operator=(unsigned long long v) {
......
...@@ -80,10 +80,8 @@ std::ostream& operator<<(std::ostream& os, StatusCode code) { ...@@ -80,10 +80,8 @@ std::ostream& operator<<(std::ostream& os, StatusCode code) {
namespace status_internal { namespace status_internal {
static absl::optional<size_t> FindPayloadIndexByUrl( static absl::optional<size_t> FindPayloadIndexByUrl(
const Payloads* payloads, const Payloads* payloads, absl::string_view type_url) {
absl::string_view type_url) { if (payloads == nullptr) return absl::nullopt;
if (payloads == nullptr)
return absl::nullopt;
for (size_t i = 0; i < payloads->size(); ++i) { for (size_t i = 0; i < payloads->size(); ++i) {
if ((*payloads)[i].type_url == type_url) return i; if ((*payloads)[i].type_url == type_url) return i;
...@@ -125,8 +123,7 @@ absl::optional<absl::Cord> Status::GetPayload( ...@@ -125,8 +123,7 @@ absl::optional<absl::Cord> Status::GetPayload(
const auto* payloads = GetPayloads(); const auto* payloads = GetPayloads();
absl::optional<size_t> index = absl::optional<size_t> index =
status_internal::FindPayloadIndexByUrl(payloads, type_url); status_internal::FindPayloadIndexByUrl(payloads, type_url);
if (index.has_value()) if (index.has_value()) return (*payloads)[index.value()].payload;
return (*payloads)[index.value()].payload;
return absl::nullopt; return absl::nullopt;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment