diff options
-rw-r--r-- | absl/base/log_severity.h | 2 | ||||
-rw-r--r-- | absl/numeric/int128.h | 52 | ||||
-rw-r--r-- | absl/types/optional.h | 2 |
3 files changed, 31 insertions, 25 deletions
diff --git a/absl/base/log_severity.h b/absl/base/log_severity.h index e026665eb650..e146bcb05a49 100644 --- a/absl/base/log_severity.h +++ b/absl/base/log_severity.h @@ -46,7 +46,7 @@ constexpr const char* LogSeverityName(absl::LogSeverity s) { : s == absl::LogSeverity::kFatal ? "FATAL" : "UNKNOWN"; } -// Note that out-of-range large severities normalize to kError, not kFatal. +// Note that out-of-range severities normalize to kInfo or kError, never kFatal. constexpr absl::LogSeverity NormalizeLogSeverity(absl::LogSeverity s) { return s < absl::LogSeverity::kInfo ? absl::LogSeverity::kInfo diff --git a/absl/numeric/int128.h b/absl/numeric/int128.h index 5e1b3f03c0f2..bbb76edb4ba9 100644 --- a/absl/numeric/int128.h +++ b/absl/numeric/int128.h @@ -206,7 +206,7 @@ class alignas(16) uint128 { extern const uint128 kuint128max; // allow uint128 to be logged -extern std::ostream& operator<<(std::ostream& os, uint128 v); +std::ostream& operator<<(std::ostream& os, uint128 v); // TODO(strel) add operator>>(std::istream&, uint128) @@ -287,55 +287,61 @@ 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) {} + : lo_{low}, hi_{high} {} constexpr uint128::uint128(int v) - : lo_(v), hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0) {} + : lo_{static_cast<uint64_t>(v)}, + hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0} {} constexpr uint128::uint128(long v) // NOLINT(runtime/int) - : lo_(v), hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0) {} + : lo_{static_cast<uint64_t>(v)}, + hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0} {} constexpr uint128::uint128(long long v) // NOLINT(runtime/int) - : lo_(v), hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0) {} + : lo_{static_cast<uint64_t>(v)}, + hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0} {} -constexpr uint128::uint128(unsigned int v) : lo_(v), hi_(0) {} +constexpr uint128::uint128(unsigned int v) : lo_{v}, hi_{0} {} // NOLINTNEXTLINE(runtime/int) -constexpr uint128::uint128(unsigned long v) : lo_(v), hi_(0) {} +constexpr uint128::uint128(unsigned long v) : lo_{v}, hi_{0} {} // NOLINTNEXTLINE(runtime/int) -constexpr uint128::uint128(unsigned long long v) : lo_(v), hi_(0) {} +constexpr uint128::uint128(unsigned long long v) : lo_{v}, hi_{0} {} #ifdef ABSL_HAVE_INTRINSIC_INT128 constexpr uint128::uint128(__int128 v) - : lo_(static_cast<uint64_t>(v & ~uint64_t{0})), - hi_(static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)) {} + : lo_{static_cast<uint64_t>(v & ~uint64_t{0})}, + hi_{static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)} {} constexpr uint128::uint128(unsigned __int128 v) - : lo_(static_cast<uint64_t>(v & ~uint64_t{0})), - hi_(static_cast<uint64_t>(v >> 64)) {} + : lo_{static_cast<uint64_t>(v & ~uint64_t{0})}, + hi_{static_cast<uint64_t>(v >> 64)} {} #endif // ABSL_HAVE_INTRINSIC_INT128 #elif defined(ABSL_IS_BIG_ENDIAN) constexpr uint128::uint128(uint64_t high, uint64_t low) - : hi_(high), lo_(low) {} + : hi_{high}, lo_{low} {} constexpr uint128::uint128(int v) - : hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0), lo_(v) {} + : hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0}, + lo_{static_cast<uint64_t>(v)} {} constexpr uint128::uint128(long v) // NOLINT(runtime/int) - : hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0), lo_(v) {} + : hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0}, + lo_{static_cast<uint64_t>(v)} {} constexpr uint128::uint128(long long v) // NOLINT(runtime/int) - : hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0), lo_(v) {} + : hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0}, + lo_{static_cast<uint64_t>(v)} {} -constexpr uint128::uint128(unsigned int v) : hi_(0), lo_(v) {} +constexpr uint128::uint128(unsigned int v) : hi_{0}, lo_{v} {} // NOLINTNEXTLINE(runtime/int) -constexpr uint128::uint128(unsigned long v) : hi_(0), lo_(v) {} +constexpr uint128::uint128(unsigned long v) : hi_{0}, lo_{v} {} // NOLINTNEXTLINE(runtime/int) -constexpr uint128::uint128(unsigned long long v) : hi_(0), lo_(v) {} +constexpr uint128::uint128(unsigned long long v) : hi_{0}, lo_{v} {} #ifdef ABSL_HAVE_INTRINSIC_INT128 constexpr uint128::uint128(__int128 v) - : hi_(static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)), - lo_(static_cast<uint64_t>(v & ~uint64_t{0})) {} + : hi_{static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)}, + lo_{static_cast<uint64_t>(v & ~uint64_t{0})} {} constexpr uint128::uint128(unsigned __int128 v) - : hi_(static_cast<uint64_t>(v >> 64)), - lo_(static_cast<uint64_t>(v & ~uint64_t{0})) {} + : hi_{static_cast<uint64_t>(v >> 64)}, + lo_{static_cast<uint64_t>(v & ~uint64_t{0})} {} #endif // ABSL_HAVE_INTRINSIC_INT128 #else // byte order diff --git a/absl/types/optional.h b/absl/types/optional.h index 07e439448dcc..9313fd23c0bb 100644 --- a/absl/types/optional.h +++ b/absl/types/optional.h @@ -845,7 +845,7 @@ class optional : private optional_internal::optional_data<T>, // optional::value_or() // - // Returns either the value of `T` or a passed default `val` if the `optional` + // Returns either the value of `T` or a passed default `v` if the `optional` // is empty. template <typename U> constexpr T value_or(U&& v) const& { |