summaryrefslogtreecommitdiffstats
path: root/contrib/restricted/abseil-cpp-tstring/y_absl/numeric
diff options
context:
space:
mode:
authorthegeorg <[email protected]>2023-03-25 20:23:17 +0300
committerthegeorg <[email protected]>2023-03-25 20:23:17 +0300
commita50a4399c2600b05a086acdca3ba56c957d62196 (patch)
tree2cf3f6cc37ccc6bd19c33a928e07dd6c083cea72 /contrib/restricted/abseil-cpp-tstring/y_absl/numeric
parent76f3ccf647d9cff0e38a7989dc89480854107b78 (diff)
Update contrib/restricted/abseil-cpp-tstring to 20230125.1
Diffstat (limited to 'contrib/restricted/abseil-cpp-tstring/y_absl/numeric')
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/numeric/bits.h5
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/numeric/int128.cc18
2 files changed, 12 insertions, 11 deletions
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/bits.h b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/bits.h
index 75cd272d777..501c756da5e 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/bits.h
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/bits.h
@@ -131,10 +131,9 @@ has_single_bit(T x) noexcept {
// fractional part discarded.
template <class T>
Y_ABSL_INTERNAL_CONSTEXPR_CLZ inline
- typename std::enable_if<std::is_unsigned<T>::value, T>::type
+ typename std::enable_if<std::is_unsigned<T>::value, int>::type
bit_width(T x) noexcept {
- return std::numeric_limits<T>::digits -
- static_cast<unsigned int>(countl_zero(x));
+ return std::numeric_limits<T>::digits - countl_zero(x);
}
// Returns: If x == 0, 0; otherwise the maximal value y such that
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/int128.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/int128.cc
index fe9d65cc63b..a054aad2c10 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/int128.cc
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/int128.cc
@@ -209,15 +209,16 @@ std::ostream& operator<<(std::ostream& os, uint128 v) {
// Add the requisite padding.
std::streamsize width = os.width(0);
if (static_cast<size_t>(width) > rep.size()) {
+ const size_t count = static_cast<size_t>(width) - rep.size();
std::ios::fmtflags adjustfield = flags & std::ios::adjustfield;
if (adjustfield == std::ios::left) {
- rep.append(width - rep.size(), os.fill());
+ rep.append(count, os.fill());
} else if (adjustfield == std::ios::internal &&
(flags & std::ios::showbase) &&
(flags & std::ios::basefield) == std::ios::hex && v != 0) {
- rep.insert((size_t)2, width - rep.size(), os.fill());
+ rep.insert((size_t)2, count, os.fill());
} else {
- rep.insert((size_t)0, width - rep.size(), os.fill());
+ rep.insert((size_t)0, count, os.fill());
}
}
@@ -306,22 +307,23 @@ std::ostream& operator<<(std::ostream& os, int128 v) {
// Add the requisite padding.
std::streamsize width = os.width(0);
if (static_cast<size_t>(width) > rep.size()) {
+ const size_t count = static_cast<size_t>(width) - rep.size();
switch (flags & std::ios::adjustfield) {
case std::ios::left:
- rep.append(width - rep.size(), os.fill());
+ rep.append(count, os.fill());
break;
case std::ios::internal:
if (print_as_decimal && (rep[0] == '+' || rep[0] == '-')) {
- rep.insert(1, width - rep.size(), os.fill());
+ rep.insert(1u, count, os.fill());
} else if ((flags & std::ios::basefield) == std::ios::hex &&
(flags & std::ios::showbase) && v != 0) {
- rep.insert((size_t)2, width - rep.size(), os.fill());
+ rep.insert((size_t)2, count, os.fill());
} else {
- rep.insert((size_t)0, width - rep.size(), os.fill());
+ rep.insert((size_t)0, count, os.fill());
}
break;
default: // std::ios::right
- rep.insert((size_t)0, width - rep.size(), os.fill());
+ rep.insert((size_t)0, count, os.fill());
break;
}
}