aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/abseil-cpp-tstring/y_absl/numeric
diff options
context:
space:
mode:
authorheretic <heretic@yandex-team.ru>2022-02-10 16:45:43 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:43 +0300
commit397cbe258b9e064f49c4ca575279f02f39fef76e (patch)
treea0b0eb3cca6a14e4e8ea715393637672fa651284 /contrib/restricted/abseil-cpp-tstring/y_absl/numeric
parent43f5a35593ebc9f6bcea619bb170394ea7ae468e (diff)
downloadydb-397cbe258b9e064f49c4ca575279f02f39fef76e.tar.gz
Restoring authorship annotation for <heretic@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/restricted/abseil-cpp-tstring/y_absl/numeric')
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/numeric/.yandex_meta/licenses.list.txt76
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/numeric/bits.h354
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/numeric/int128.cc26
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/numeric/int128.h26
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/numeric/internal/bits.h716
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/numeric/internal/representation.h110
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/numeric/ya.make12
7 files changed, 660 insertions, 660 deletions
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/.yandex_meta/licenses.list.txt
index 3d70f7ab0e..c0fb99bcfc 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/.yandex_meta/licenses.list.txt
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/.yandex_meta/licenses.list.txt
@@ -1,38 +1,38 @@
-====================Apache-2.0====================
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-====================Apache-2.0====================
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-====================COPYRIGHT====================
-// Copyright 2017 The Abseil Authors.
-
-
-====================COPYRIGHT====================
-// Copyright 2020 The Abseil Authors.
-
-
-====================COPYRIGHT====================
-// Copyright 2021 The Abseil Authors.
+====================Apache-2.0====================
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+
+====================Apache-2.0====================
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+
+====================COPYRIGHT====================
+// Copyright 2017 The Abseil Authors.
+
+
+====================COPYRIGHT====================
+// Copyright 2020 The Abseil Authors.
+
+
+====================COPYRIGHT====================
+// Copyright 2021 The Abseil Authors.
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 92cb0c3a91..40f6e85f08 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/bits.h
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/bits.h
@@ -1,177 +1,177 @@
-// Copyright 2020 The Abseil Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-// -----------------------------------------------------------------------------
-// File: bits.h
-// -----------------------------------------------------------------------------
-//
-// This file contains implementations of C++20's bitwise math functions, as
-// defined by:
-//
-// P0553R4:
-// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0553r4.html
-// P0556R3:
-// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0556r3.html
-// P1355R2:
-// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1355r2.html
-// P1956R1:
-// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1956r1.pdf
-//
-// When using a standard library that implements these functions, we use the
-// standard library's implementation.
-
-#ifndef ABSL_NUMERIC_BITS_H_
-#define ABSL_NUMERIC_BITS_H_
-
-#include <cstdint>
-#include <limits>
-#include <type_traits>
-
-#if (defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L) || \
- (defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L)
-#include <bit>
-#endif
-
-#include "y_absl/base/attributes.h"
-#include "y_absl/base/config.h"
-#include "y_absl/numeric/internal/bits.h"
-
-namespace y_absl {
-ABSL_NAMESPACE_BEGIN
-
-#if !(defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L)
-// rotating
-template <class T>
-ABSL_MUST_USE_RESULT constexpr
- typename std::enable_if<std::is_unsigned<T>::value, T>::type
- rotl(T x, int s) noexcept {
- return numeric_internal::RotateLeft(x, s);
-}
-
-template <class T>
-ABSL_MUST_USE_RESULT constexpr
- typename std::enable_if<std::is_unsigned<T>::value, T>::type
- rotr(T x, int s) noexcept {
- return numeric_internal::RotateRight(x, s);
-}
-
-// Counting functions
-//
-// While these functions are typically constexpr, on some platforms, they may
-// not be marked as constexpr due to constraints of the compiler/available
-// intrinsics.
-template <class T>
-ABSL_INTERNAL_CONSTEXPR_CLZ inline
- typename std::enable_if<std::is_unsigned<T>::value, int>::type
- countl_zero(T x) noexcept {
- return numeric_internal::CountLeadingZeroes(x);
-}
-
-template <class T>
-ABSL_INTERNAL_CONSTEXPR_CLZ inline
- typename std::enable_if<std::is_unsigned<T>::value, int>::type
- countl_one(T x) noexcept {
- // Avoid integer promotion to a wider type
- return countl_zero(static_cast<T>(~x));
-}
-
-template <class T>
-ABSL_INTERNAL_CONSTEXPR_CTZ inline
- typename std::enable_if<std::is_unsigned<T>::value, int>::type
- countr_zero(T x) noexcept {
- return numeric_internal::CountTrailingZeroes(x);
-}
-
-template <class T>
-ABSL_INTERNAL_CONSTEXPR_CTZ inline
- typename std::enable_if<std::is_unsigned<T>::value, int>::type
- countr_one(T x) noexcept {
- // Avoid integer promotion to a wider type
- return countr_zero(static_cast<T>(~x));
-}
-
-template <class T>
-ABSL_INTERNAL_CONSTEXPR_POPCOUNT inline
- typename std::enable_if<std::is_unsigned<T>::value, int>::type
- popcount(T x) noexcept {
- return numeric_internal::Popcount(x);
-}
-#else // defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
-
-using std::countl_one;
-using std::countl_zero;
-using std::countr_one;
-using std::countr_zero;
-using std::popcount;
-using std::rotl;
-using std::rotr;
-
-#endif
-
-#if !(defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L)
-// Returns: true if x is an integral power of two; false otherwise.
-template <class T>
-constexpr inline typename std::enable_if<std::is_unsigned<T>::value, bool>::type
-has_single_bit(T x) noexcept {
- return x != 0 && (x & (x - 1)) == 0;
-}
-
-// Returns: If x == 0, 0; otherwise one plus the base-2 logarithm of x, with any
-// fractional part discarded.
-template <class T>
-ABSL_INTERNAL_CONSTEXPR_CLZ inline
- typename std::enable_if<std::is_unsigned<T>::value, T>::type
- bit_width(T x) noexcept {
- return std::numeric_limits<T>::digits - countl_zero(x);
-}
-
-// Returns: If x == 0, 0; otherwise the maximal value y such that
-// has_single_bit(y) is true and y <= x.
-template <class T>
-ABSL_INTERNAL_CONSTEXPR_CLZ inline
- typename std::enable_if<std::is_unsigned<T>::value, T>::type
- bit_floor(T x) noexcept {
- return x == 0 ? 0 : T{1} << (bit_width(x) - 1);
-}
-
-// Returns: N, where N is the smallest power of 2 greater than or equal to x.
-//
-// Preconditions: N is representable as a value of type T.
-template <class T>
-ABSL_INTERNAL_CONSTEXPR_CLZ inline
- typename std::enable_if<std::is_unsigned<T>::value, T>::type
- bit_ceil(T x) {
- // If T is narrower than unsigned, T{1} << bit_width will be promoted. We
- // want to force it to wraparound so that bit_ceil of an invalid value are not
- // core constant expressions.
- //
- // BitCeilNonPowerOf2 triggers an overflow in constexpr contexts if we would
- // undergo promotion to unsigned but not fit the result into T without
- // truncation.
- return has_single_bit(x) ? T{1} << (bit_width(x) - 1)
- : numeric_internal::BitCeilNonPowerOf2(x);
-}
-#else // defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L
-
-using std::bit_ceil;
-using std::bit_floor;
-using std::bit_width;
-using std::has_single_bit;
-
-#endif
-
-ABSL_NAMESPACE_END
-} // namespace y_absl
-
-#endif // ABSL_NUMERIC_BITS_H_
+// Copyright 2020 The Abseil Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: bits.h
+// -----------------------------------------------------------------------------
+//
+// This file contains implementations of C++20's bitwise math functions, as
+// defined by:
+//
+// P0553R4:
+// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0553r4.html
+// P0556R3:
+// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0556r3.html
+// P1355R2:
+// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1355r2.html
+// P1956R1:
+// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1956r1.pdf
+//
+// When using a standard library that implements these functions, we use the
+// standard library's implementation.
+
+#ifndef ABSL_NUMERIC_BITS_H_
+#define ABSL_NUMERIC_BITS_H_
+
+#include <cstdint>
+#include <limits>
+#include <type_traits>
+
+#if (defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L) || \
+ (defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L)
+#include <bit>
+#endif
+
+#include "y_absl/base/attributes.h"
+#include "y_absl/base/config.h"
+#include "y_absl/numeric/internal/bits.h"
+
+namespace y_absl {
+ABSL_NAMESPACE_BEGIN
+
+#if !(defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L)
+// rotating
+template <class T>
+ABSL_MUST_USE_RESULT constexpr
+ typename std::enable_if<std::is_unsigned<T>::value, T>::type
+ rotl(T x, int s) noexcept {
+ return numeric_internal::RotateLeft(x, s);
+}
+
+template <class T>
+ABSL_MUST_USE_RESULT constexpr
+ typename std::enable_if<std::is_unsigned<T>::value, T>::type
+ rotr(T x, int s) noexcept {
+ return numeric_internal::RotateRight(x, s);
+}
+
+// Counting functions
+//
+// While these functions are typically constexpr, on some platforms, they may
+// not be marked as constexpr due to constraints of the compiler/available
+// intrinsics.
+template <class T>
+ABSL_INTERNAL_CONSTEXPR_CLZ inline
+ typename std::enable_if<std::is_unsigned<T>::value, int>::type
+ countl_zero(T x) noexcept {
+ return numeric_internal::CountLeadingZeroes(x);
+}
+
+template <class T>
+ABSL_INTERNAL_CONSTEXPR_CLZ inline
+ typename std::enable_if<std::is_unsigned<T>::value, int>::type
+ countl_one(T x) noexcept {
+ // Avoid integer promotion to a wider type
+ return countl_zero(static_cast<T>(~x));
+}
+
+template <class T>
+ABSL_INTERNAL_CONSTEXPR_CTZ inline
+ typename std::enable_if<std::is_unsigned<T>::value, int>::type
+ countr_zero(T x) noexcept {
+ return numeric_internal::CountTrailingZeroes(x);
+}
+
+template <class T>
+ABSL_INTERNAL_CONSTEXPR_CTZ inline
+ typename std::enable_if<std::is_unsigned<T>::value, int>::type
+ countr_one(T x) noexcept {
+ // Avoid integer promotion to a wider type
+ return countr_zero(static_cast<T>(~x));
+}
+
+template <class T>
+ABSL_INTERNAL_CONSTEXPR_POPCOUNT inline
+ typename std::enable_if<std::is_unsigned<T>::value, int>::type
+ popcount(T x) noexcept {
+ return numeric_internal::Popcount(x);
+}
+#else // defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
+
+using std::countl_one;
+using std::countl_zero;
+using std::countr_one;
+using std::countr_zero;
+using std::popcount;
+using std::rotl;
+using std::rotr;
+
+#endif
+
+#if !(defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L)
+// Returns: true if x is an integral power of two; false otherwise.
+template <class T>
+constexpr inline typename std::enable_if<std::is_unsigned<T>::value, bool>::type
+has_single_bit(T x) noexcept {
+ return x != 0 && (x & (x - 1)) == 0;
+}
+
+// Returns: If x == 0, 0; otherwise one plus the base-2 logarithm of x, with any
+// fractional part discarded.
+template <class T>
+ABSL_INTERNAL_CONSTEXPR_CLZ inline
+ typename std::enable_if<std::is_unsigned<T>::value, T>::type
+ bit_width(T x) noexcept {
+ return std::numeric_limits<T>::digits - countl_zero(x);
+}
+
+// Returns: If x == 0, 0; otherwise the maximal value y such that
+// has_single_bit(y) is true and y <= x.
+template <class T>
+ABSL_INTERNAL_CONSTEXPR_CLZ inline
+ typename std::enable_if<std::is_unsigned<T>::value, T>::type
+ bit_floor(T x) noexcept {
+ return x == 0 ? 0 : T{1} << (bit_width(x) - 1);
+}
+
+// Returns: N, where N is the smallest power of 2 greater than or equal to x.
+//
+// Preconditions: N is representable as a value of type T.
+template <class T>
+ABSL_INTERNAL_CONSTEXPR_CLZ inline
+ typename std::enable_if<std::is_unsigned<T>::value, T>::type
+ bit_ceil(T x) {
+ // If T is narrower than unsigned, T{1} << bit_width will be promoted. We
+ // want to force it to wraparound so that bit_ceil of an invalid value are not
+ // core constant expressions.
+ //
+ // BitCeilNonPowerOf2 triggers an overflow in constexpr contexts if we would
+ // undergo promotion to unsigned but not fit the result into T without
+ // truncation.
+ return has_single_bit(x) ? T{1} << (bit_width(x) - 1)
+ : numeric_internal::BitCeilNonPowerOf2(x);
+}
+#else // defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L
+
+using std::bit_ceil;
+using std::bit_floor;
+using std::bit_width;
+using std::has_single_bit;
+
+#endif
+
+ABSL_NAMESPACE_END
+} // namespace y_absl
+
+#endif // ABSL_NUMERIC_BITS_H_
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 6172372d75..b1d350385e 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/int128.cc
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/int128.cc
@@ -15,7 +15,7 @@
#include "y_absl/numeric/int128.h"
#include <stddef.h>
-
+
#include <cassert>
#include <iomanip>
#include <ostream> // NOLINT(readability/streams)
@@ -23,9 +23,9 @@
#include <util/generic/string.h>
#include <type_traits>
-#include "y_absl/base/optimization.h"
-#include "y_absl/numeric/bits.h"
-
+#include "y_absl/base/optimization.h"
+#include "y_absl/numeric/bits.h"
+
namespace y_absl {
ABSL_NAMESPACE_BEGIN
@@ -35,26 +35,26 @@ ABSL_DLL const uint128 kuint128max = MakeUint128(
namespace {
// Returns the 0-based position of the last set bit (i.e., most significant bit)
-// in the given uint128. The argument is not 0.
+// in the given uint128. The argument is not 0.
//
// For example:
// Given: 5 (decimal) == 101 (binary)
// Returns: 2
-inline ABSL_ATTRIBUTE_ALWAYS_INLINE int Fls128(uint128 n) {
+inline ABSL_ATTRIBUTE_ALWAYS_INLINE int Fls128(uint128 n) {
if (uint64_t hi = Uint128High64(n)) {
- ABSL_INTERNAL_ASSUME(hi != 0);
- return 127 - countl_zero(hi);
+ ABSL_INTERNAL_ASSUME(hi != 0);
+ return 127 - countl_zero(hi);
}
- const uint64_t low = Uint128Low64(n);
- ABSL_INTERNAL_ASSUME(low != 0);
- return 63 - countl_zero(low);
+ const uint64_t low = Uint128Low64(n);
+ ABSL_INTERNAL_ASSUME(low != 0);
+ return 63 - countl_zero(low);
}
// Long division/modulo for uint128 implemented using the shift-subtract
// division algorithm adapted from:
// https://stackoverflow.com/questions/5386377/division-without-using
-inline void DivModImpl(uint128 dividend, uint128 divisor, uint128* quotient_ret,
- uint128* remainder_ret) {
+inline void DivModImpl(uint128 dividend, uint128 divisor, uint128* quotient_ret,
+ uint128* remainder_ret) {
assert(divisor != 0);
if (divisor > dividend) {
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/int128.h b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/int128.h
index b54d614ce9..d5b8ff3a66 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/int128.h
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/int128.h
@@ -799,14 +799,14 @@ constexpr bool operator==(uint128 lhs, uint128 rhs) {
constexpr bool operator!=(uint128 lhs, uint128 rhs) { return !(lhs == rhs); }
constexpr bool operator<(uint128 lhs, uint128 rhs) {
-#ifdef ABSL_HAVE_INTRINSIC_INT128
- return static_cast<unsigned __int128>(lhs) <
- static_cast<unsigned __int128>(rhs);
-#else
+#ifdef ABSL_HAVE_INTRINSIC_INT128
+ return static_cast<unsigned __int128>(lhs) <
+ static_cast<unsigned __int128>(rhs);
+#else
return (Uint128High64(lhs) == Uint128High64(rhs))
? (Uint128Low64(lhs) < Uint128Low64(rhs))
: (Uint128High64(lhs) < Uint128High64(rhs));
-#endif
+#endif
}
constexpr bool operator>(uint128 lhs, uint128 rhs) { return rhs < lhs; }
@@ -901,9 +901,9 @@ inline uint128& uint128::operator^=(uint128 other) {
// Arithmetic operators.
constexpr uint128 operator<<(uint128 lhs, int amount) {
-#ifdef ABSL_HAVE_INTRINSIC_INT128
- return static_cast<unsigned __int128>(lhs) << amount;
-#else
+#ifdef ABSL_HAVE_INTRINSIC_INT128
+ return static_cast<unsigned __int128>(lhs) << 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)
@@ -911,13 +911,13 @@ constexpr uint128 operator<<(uint128 lhs, int amount) {
: MakeUint128((Uint128High64(lhs) << amount) |
(Uint128Low64(lhs) >> (64 - amount)),
Uint128Low64(lhs) << amount);
-#endif
+#endif
}
constexpr uint128 operator>>(uint128 lhs, int amount) {
-#ifdef ABSL_HAVE_INTRINSIC_INT128
- return static_cast<unsigned __int128>(lhs) >> amount;
-#else
+#ifdef ABSL_HAVE_INTRINSIC_INT128
+ return static_cast<unsigned __int128>(lhs) >> 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))
@@ -925,7 +925,7 @@ constexpr uint128 operator>>(uint128 lhs, int amount) {
: MakeUint128(Uint128High64(lhs) >> amount,
(Uint128Low64(lhs) >> amount) |
(Uint128High64(lhs) << (64 - amount)));
-#endif
+#endif
}
#if !defined(ABSL_HAVE_INTRINSIC_INT128)
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/internal/bits.h b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/internal/bits.h
index 2a517399b0..da3d2a9eb6 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/internal/bits.h
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/internal/bits.h
@@ -1,358 +1,358 @@
-// Copyright 2020 The Abseil Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef ABSL_NUMERIC_INTERNAL_BITS_H_
-#define ABSL_NUMERIC_INTERNAL_BITS_H_
-
-#include <cstdint>
-#include <limits>
-#include <type_traits>
-
-// Clang on Windows has __builtin_clzll; otherwise we need to use the
-// windows intrinsic functions.
-#if defined(_MSC_VER) && !defined(__clang__)
-#include <intrin.h>
-#endif
-
-#include "y_absl/base/attributes.h"
-#include "y_absl/base/config.h"
-
-#if defined(__GNUC__) && !defined(__clang__)
-// GCC
-#define ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(x) 1
-#else
-#define ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(x) ABSL_HAVE_BUILTIN(x)
-#endif
-
-#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_popcountl) && \
- ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_popcountll)
-#define ABSL_INTERNAL_CONSTEXPR_POPCOUNT constexpr
-#define ABSL_INTERNAL_HAS_CONSTEXPR_POPCOUNT 1
-#else
-#define ABSL_INTERNAL_CONSTEXPR_POPCOUNT
-#define ABSL_INTERNAL_HAS_CONSTEXPR_POPCOUNT 0
-#endif
-
-#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_clz) && \
- ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_clzll)
-#define ABSL_INTERNAL_CONSTEXPR_CLZ constexpr
-#define ABSL_INTERNAL_HAS_CONSTEXPR_CLZ 1
-#else
-#define ABSL_INTERNAL_CONSTEXPR_CLZ
-#define ABSL_INTERNAL_HAS_CONSTEXPR_CLZ 0
-#endif
-
-#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_ctz) && \
- ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_ctzll)
-#define ABSL_INTERNAL_CONSTEXPR_CTZ constexpr
-#define ABSL_INTERNAL_HAS_CONSTEXPR_CTZ 1
-#else
-#define ABSL_INTERNAL_CONSTEXPR_CTZ
-#define ABSL_INTERNAL_HAS_CONSTEXPR_CTZ 0
-#endif
-
-namespace y_absl {
-ABSL_NAMESPACE_BEGIN
-namespace numeric_internal {
-
-constexpr bool IsPowerOf2(unsigned int x) noexcept {
- return x != 0 && (x & (x - 1)) == 0;
-}
-
-template <class T>
-ABSL_MUST_USE_RESULT ABSL_ATTRIBUTE_ALWAYS_INLINE constexpr T RotateRight(
- T x, int s) noexcept {
- static_assert(std::is_unsigned<T>::value, "T must be unsigned");
- static_assert(IsPowerOf2(std::numeric_limits<T>::digits),
- "T must have a power-of-2 size");
-
- return static_cast<T>(x >> (s & (std::numeric_limits<T>::digits - 1))) |
- static_cast<T>(x << ((-s) & (std::numeric_limits<T>::digits - 1)));
-}
-
-template <class T>
-ABSL_MUST_USE_RESULT ABSL_ATTRIBUTE_ALWAYS_INLINE constexpr T RotateLeft(
- T x, int s) noexcept {
- static_assert(std::is_unsigned<T>::value, "T must be unsigned");
- static_assert(IsPowerOf2(std::numeric_limits<T>::digits),
- "T must have a power-of-2 size");
-
- return static_cast<T>(x << (s & (std::numeric_limits<T>::digits - 1))) |
- static_cast<T>(x >> ((-s) & (std::numeric_limits<T>::digits - 1)));
-}
-
-ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_POPCOUNT inline int
-Popcount32(uint32_t x) noexcept {
-#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_popcount)
- static_assert(sizeof(unsigned int) == sizeof(x),
- "__builtin_popcount does not take 32-bit arg");
- return __builtin_popcount(x);
-#else
- x -= ((x >> 1) & 0x55555555);
- x = ((x >> 2) & 0x33333333) + (x & 0x33333333);
- return static_cast<int>((((x + (x >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24);
-#endif
-}
-
-ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_POPCOUNT inline int
-Popcount64(uint64_t x) noexcept {
-#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_popcountll)
- static_assert(sizeof(unsigned long long) == sizeof(x), // NOLINT(runtime/int)
- "__builtin_popcount does not take 64-bit arg");
- return __builtin_popcountll(x);
-#else
- x -= (x >> 1) & 0x5555555555555555ULL;
- x = ((x >> 2) & 0x3333333333333333ULL) + (x & 0x3333333333333333ULL);
- return static_cast<int>(
- (((x + (x >> 4)) & 0xF0F0F0F0F0F0F0FULL) * 0x101010101010101ULL) >> 56);
-#endif
-}
-
-template <class T>
-ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_POPCOUNT inline int
-Popcount(T x) noexcept {
- static_assert(std::is_unsigned<T>::value, "T must be unsigned");
- static_assert(IsPowerOf2(std::numeric_limits<T>::digits),
- "T must have a power-of-2 size");
- static_assert(sizeof(x) <= sizeof(uint64_t), "T is too large");
- return sizeof(x) <= sizeof(uint32_t) ? Popcount32(x) : Popcount64(x);
-}
-
-ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CLZ inline int
-CountLeadingZeroes32(uint32_t x) {
-#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_clz)
- // Use __builtin_clz, which uses the following instructions:
- // x86: bsr, lzcnt
- // ARM64: clz
- // PPC: cntlzd
-
- static_assert(sizeof(unsigned int) == sizeof(x),
- "__builtin_clz does not take 32-bit arg");
- // Handle 0 as a special case because __builtin_clz(0) is undefined.
- return x == 0 ? 32 : __builtin_clz(x);
-#elif defined(_MSC_VER) && !defined(__clang__)
- unsigned long result = 0; // NOLINT(runtime/int)
- if (_BitScanReverse(&result, x)) {
- return 31 - result;
- }
- return 32;
-#else
- int zeroes = 28;
- if (x >> 16) {
- zeroes -= 16;
- x >>= 16;
- }
- if (x >> 8) {
- zeroes -= 8;
- x >>= 8;
- }
- if (x >> 4) {
- zeroes -= 4;
- x >>= 4;
- }
- return "\4\3\2\2\1\1\1\1\0\0\0\0\0\0\0"[x] + zeroes;
-#endif
-}
-
-ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CLZ inline int
-CountLeadingZeroes16(uint16_t x) {
-#if ABSL_HAVE_BUILTIN(__builtin_clzs)
- static_assert(sizeof(unsigned short) == sizeof(x), // NOLINT(runtime/int)
- "__builtin_clzs does not take 16-bit arg");
- return x == 0 ? 16 : __builtin_clzs(x);
-#else
- return CountLeadingZeroes32(x) - 16;
-#endif
-}
-
-ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CLZ inline int
-CountLeadingZeroes64(uint64_t x) {
-#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_clzll)
- // Use __builtin_clzll, which uses the following instructions:
- // x86: bsr, lzcnt
- // ARM64: clz
- // PPC: cntlzd
- static_assert(sizeof(unsigned long long) == sizeof(x), // NOLINT(runtime/int)
- "__builtin_clzll does not take 64-bit arg");
-
- // Handle 0 as a special case because __builtin_clzll(0) is undefined.
- return x == 0 ? 64 : __builtin_clzll(x);
-#elif defined(_MSC_VER) && !defined(__clang__) && \
- (defined(_M_X64) || defined(_M_ARM64))
- // MSVC does not have __buitin_clzll. Use _BitScanReverse64.
- unsigned long result = 0; // NOLINT(runtime/int)
- if (_BitScanReverse64(&result, x)) {
- return 63 - result;
- }
- return 64;
-#elif defined(_MSC_VER) && !defined(__clang__)
- // MSVC does not have __buitin_clzll. Compose two calls to _BitScanReverse
- unsigned long result = 0; // NOLINT(runtime/int)
- if ((x >> 32) &&
- _BitScanReverse(&result, static_cast<unsigned long>(x >> 32))) {
- return 31 - result;
- }
- if (_BitScanReverse(&result, static_cast<unsigned long>(x))) {
- return 63 - result;
- }
- return 64;
-#else
- int zeroes = 60;
- if (x >> 32) {
- zeroes -= 32;
- x >>= 32;
- }
- if (x >> 16) {
- zeroes -= 16;
- x >>= 16;
- }
- if (x >> 8) {
- zeroes -= 8;
- x >>= 8;
- }
- if (x >> 4) {
- zeroes -= 4;
- x >>= 4;
- }
- return "\4\3\2\2\1\1\1\1\0\0\0\0\0\0\0"[x] + zeroes;
-#endif
-}
-
-template <typename T>
-ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CLZ inline int
-CountLeadingZeroes(T x) {
- static_assert(std::is_unsigned<T>::value, "T must be unsigned");
- static_assert(IsPowerOf2(std::numeric_limits<T>::digits),
- "T must have a power-of-2 size");
- static_assert(sizeof(T) <= sizeof(uint64_t), "T too large");
- return sizeof(T) <= sizeof(uint16_t)
- ? CountLeadingZeroes16(static_cast<uint16_t>(x)) -
- (std::numeric_limits<uint16_t>::digits -
- std::numeric_limits<T>::digits)
- : (sizeof(T) <= sizeof(uint32_t)
- ? CountLeadingZeroes32(static_cast<uint32_t>(x)) -
- (std::numeric_limits<uint32_t>::digits -
- std::numeric_limits<T>::digits)
- : CountLeadingZeroes64(x));
-}
-
-ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CTZ inline int
-CountTrailingZeroesNonzero32(uint32_t x) {
-#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_ctz)
- static_assert(sizeof(unsigned int) == sizeof(x),
- "__builtin_ctz does not take 32-bit arg");
- return __builtin_ctz(x);
-#elif defined(_MSC_VER) && !defined(__clang__)
- unsigned long result = 0; // NOLINT(runtime/int)
- _BitScanForward(&result, x);
- return result;
-#else
- int c = 31;
- x &= ~x + 1;
- if (x & 0x0000FFFF) c -= 16;
- if (x & 0x00FF00FF) c -= 8;
- if (x & 0x0F0F0F0F) c -= 4;
- if (x & 0x33333333) c -= 2;
- if (x & 0x55555555) c -= 1;
- return c;
-#endif
-}
-
-ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CTZ inline int
-CountTrailingZeroesNonzero64(uint64_t x) {
-#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_ctzll)
- static_assert(sizeof(unsigned long long) == sizeof(x), // NOLINT(runtime/int)
- "__builtin_ctzll does not take 64-bit arg");
- return __builtin_ctzll(x);
-#elif defined(_MSC_VER) && !defined(__clang__) && \
- (defined(_M_X64) || defined(_M_ARM64))
- unsigned long result = 0; // NOLINT(runtime/int)
- _BitScanForward64(&result, x);
- return result;
-#elif defined(_MSC_VER) && !defined(__clang__)
- unsigned long result = 0; // NOLINT(runtime/int)
- if (static_cast<uint32_t>(x) == 0) {
- _BitScanForward(&result, static_cast<unsigned long>(x >> 32));
- return result + 32;
- }
- _BitScanForward(&result, static_cast<unsigned long>(x));
- return result;
-#else
- int c = 63;
- x &= ~x + 1;
- if (x & 0x00000000FFFFFFFF) c -= 32;
- if (x & 0x0000FFFF0000FFFF) c -= 16;
- if (x & 0x00FF00FF00FF00FF) c -= 8;
- if (x & 0x0F0F0F0F0F0F0F0F) c -= 4;
- if (x & 0x3333333333333333) c -= 2;
- if (x & 0x5555555555555555) c -= 1;
- return c;
-#endif
-}
-
-ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CTZ inline int
-CountTrailingZeroesNonzero16(uint16_t x) {
-#if ABSL_HAVE_BUILTIN(__builtin_ctzs)
- static_assert(sizeof(unsigned short) == sizeof(x), // NOLINT(runtime/int)
- "__builtin_ctzs does not take 16-bit arg");
- return __builtin_ctzs(x);
-#else
- return CountTrailingZeroesNonzero32(x);
-#endif
-}
-
-template <class T>
-ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CTZ inline int
-CountTrailingZeroes(T x) noexcept {
- static_assert(std::is_unsigned<T>::value, "T must be unsigned");
- static_assert(IsPowerOf2(std::numeric_limits<T>::digits),
- "T must have a power-of-2 size");
- static_assert(sizeof(T) <= sizeof(uint64_t), "T too large");
- return x == 0 ? std::numeric_limits<T>::digits
- : (sizeof(T) <= sizeof(uint16_t)
- ? CountTrailingZeroesNonzero16(static_cast<uint16_t>(x))
- : (sizeof(T) <= sizeof(uint32_t)
- ? CountTrailingZeroesNonzero32(
- static_cast<uint32_t>(x))
- : CountTrailingZeroesNonzero64(x)));
-}
-
-// If T is narrower than unsigned, T{1} << bit_width will be promoted. We
-// want to force it to wraparound so that bit_ceil of an invalid value are not
-// core constant expressions.
-template <class T>
-ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CLZ inline
- typename std::enable_if<std::is_unsigned<T>::value, T>::type
- BitCeilPromotionHelper(T x, T promotion) {
- return (T{1} << (x + promotion)) >> promotion;
-}
-
-template <class T>
-ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CLZ inline
- typename std::enable_if<std::is_unsigned<T>::value, T>::type
- BitCeilNonPowerOf2(T x) {
- // If T is narrower than unsigned, it undergoes promotion to unsigned when we
- // shift. We calculate the number of bits added by the wider type.
- return BitCeilPromotionHelper(
- static_cast<T>(std::numeric_limits<T>::digits - CountLeadingZeroes(x)),
- T{sizeof(T) >= sizeof(unsigned) ? 0
- : std::numeric_limits<unsigned>::digits -
- std::numeric_limits<T>::digits});
-}
-
-} // namespace numeric_internal
-ABSL_NAMESPACE_END
-} // namespace y_absl
-
-#endif // ABSL_NUMERIC_INTERNAL_BITS_H_
+// Copyright 2020 The Abseil Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_NUMERIC_INTERNAL_BITS_H_
+#define ABSL_NUMERIC_INTERNAL_BITS_H_
+
+#include <cstdint>
+#include <limits>
+#include <type_traits>
+
+// Clang on Windows has __builtin_clzll; otherwise we need to use the
+// windows intrinsic functions.
+#if defined(_MSC_VER) && !defined(__clang__)
+#include <intrin.h>
+#endif
+
+#include "y_absl/base/attributes.h"
+#include "y_absl/base/config.h"
+
+#if defined(__GNUC__) && !defined(__clang__)
+// GCC
+#define ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(x) 1
+#else
+#define ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(x) ABSL_HAVE_BUILTIN(x)
+#endif
+
+#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_popcountl) && \
+ ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_popcountll)
+#define ABSL_INTERNAL_CONSTEXPR_POPCOUNT constexpr
+#define ABSL_INTERNAL_HAS_CONSTEXPR_POPCOUNT 1
+#else
+#define ABSL_INTERNAL_CONSTEXPR_POPCOUNT
+#define ABSL_INTERNAL_HAS_CONSTEXPR_POPCOUNT 0
+#endif
+
+#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_clz) && \
+ ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_clzll)
+#define ABSL_INTERNAL_CONSTEXPR_CLZ constexpr
+#define ABSL_INTERNAL_HAS_CONSTEXPR_CLZ 1
+#else
+#define ABSL_INTERNAL_CONSTEXPR_CLZ
+#define ABSL_INTERNAL_HAS_CONSTEXPR_CLZ 0
+#endif
+
+#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_ctz) && \
+ ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_ctzll)
+#define ABSL_INTERNAL_CONSTEXPR_CTZ constexpr
+#define ABSL_INTERNAL_HAS_CONSTEXPR_CTZ 1
+#else
+#define ABSL_INTERNAL_CONSTEXPR_CTZ
+#define ABSL_INTERNAL_HAS_CONSTEXPR_CTZ 0
+#endif
+
+namespace y_absl {
+ABSL_NAMESPACE_BEGIN
+namespace numeric_internal {
+
+constexpr bool IsPowerOf2(unsigned int x) noexcept {
+ return x != 0 && (x & (x - 1)) == 0;
+}
+
+template <class T>
+ABSL_MUST_USE_RESULT ABSL_ATTRIBUTE_ALWAYS_INLINE constexpr T RotateRight(
+ T x, int s) noexcept {
+ static_assert(std::is_unsigned<T>::value, "T must be unsigned");
+ static_assert(IsPowerOf2(std::numeric_limits<T>::digits),
+ "T must have a power-of-2 size");
+
+ return static_cast<T>(x >> (s & (std::numeric_limits<T>::digits - 1))) |
+ static_cast<T>(x << ((-s) & (std::numeric_limits<T>::digits - 1)));
+}
+
+template <class T>
+ABSL_MUST_USE_RESULT ABSL_ATTRIBUTE_ALWAYS_INLINE constexpr T RotateLeft(
+ T x, int s) noexcept {
+ static_assert(std::is_unsigned<T>::value, "T must be unsigned");
+ static_assert(IsPowerOf2(std::numeric_limits<T>::digits),
+ "T must have a power-of-2 size");
+
+ return static_cast<T>(x << (s & (std::numeric_limits<T>::digits - 1))) |
+ static_cast<T>(x >> ((-s) & (std::numeric_limits<T>::digits - 1)));
+}
+
+ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_POPCOUNT inline int
+Popcount32(uint32_t x) noexcept {
+#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_popcount)
+ static_assert(sizeof(unsigned int) == sizeof(x),
+ "__builtin_popcount does not take 32-bit arg");
+ return __builtin_popcount(x);
+#else
+ x -= ((x >> 1) & 0x55555555);
+ x = ((x >> 2) & 0x33333333) + (x & 0x33333333);
+ return static_cast<int>((((x + (x >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24);
+#endif
+}
+
+ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_POPCOUNT inline int
+Popcount64(uint64_t x) noexcept {
+#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_popcountll)
+ static_assert(sizeof(unsigned long long) == sizeof(x), // NOLINT(runtime/int)
+ "__builtin_popcount does not take 64-bit arg");
+ return __builtin_popcountll(x);
+#else
+ x -= (x >> 1) & 0x5555555555555555ULL;
+ x = ((x >> 2) & 0x3333333333333333ULL) + (x & 0x3333333333333333ULL);
+ return static_cast<int>(
+ (((x + (x >> 4)) & 0xF0F0F0F0F0F0F0FULL) * 0x101010101010101ULL) >> 56);
+#endif
+}
+
+template <class T>
+ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_POPCOUNT inline int
+Popcount(T x) noexcept {
+ static_assert(std::is_unsigned<T>::value, "T must be unsigned");
+ static_assert(IsPowerOf2(std::numeric_limits<T>::digits),
+ "T must have a power-of-2 size");
+ static_assert(sizeof(x) <= sizeof(uint64_t), "T is too large");
+ return sizeof(x) <= sizeof(uint32_t) ? Popcount32(x) : Popcount64(x);
+}
+
+ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CLZ inline int
+CountLeadingZeroes32(uint32_t x) {
+#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_clz)
+ // Use __builtin_clz, which uses the following instructions:
+ // x86: bsr, lzcnt
+ // ARM64: clz
+ // PPC: cntlzd
+
+ static_assert(sizeof(unsigned int) == sizeof(x),
+ "__builtin_clz does not take 32-bit arg");
+ // Handle 0 as a special case because __builtin_clz(0) is undefined.
+ return x == 0 ? 32 : __builtin_clz(x);
+#elif defined(_MSC_VER) && !defined(__clang__)
+ unsigned long result = 0; // NOLINT(runtime/int)
+ if (_BitScanReverse(&result, x)) {
+ return 31 - result;
+ }
+ return 32;
+#else
+ int zeroes = 28;
+ if (x >> 16) {
+ zeroes -= 16;
+ x >>= 16;
+ }
+ if (x >> 8) {
+ zeroes -= 8;
+ x >>= 8;
+ }
+ if (x >> 4) {
+ zeroes -= 4;
+ x >>= 4;
+ }
+ return "\4\3\2\2\1\1\1\1\0\0\0\0\0\0\0"[x] + zeroes;
+#endif
+}
+
+ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CLZ inline int
+CountLeadingZeroes16(uint16_t x) {
+#if ABSL_HAVE_BUILTIN(__builtin_clzs)
+ static_assert(sizeof(unsigned short) == sizeof(x), // NOLINT(runtime/int)
+ "__builtin_clzs does not take 16-bit arg");
+ return x == 0 ? 16 : __builtin_clzs(x);
+#else
+ return CountLeadingZeroes32(x) - 16;
+#endif
+}
+
+ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CLZ inline int
+CountLeadingZeroes64(uint64_t x) {
+#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_clzll)
+ // Use __builtin_clzll, which uses the following instructions:
+ // x86: bsr, lzcnt
+ // ARM64: clz
+ // PPC: cntlzd
+ static_assert(sizeof(unsigned long long) == sizeof(x), // NOLINT(runtime/int)
+ "__builtin_clzll does not take 64-bit arg");
+
+ // Handle 0 as a special case because __builtin_clzll(0) is undefined.
+ return x == 0 ? 64 : __builtin_clzll(x);
+#elif defined(_MSC_VER) && !defined(__clang__) && \
+ (defined(_M_X64) || defined(_M_ARM64))
+ // MSVC does not have __buitin_clzll. Use _BitScanReverse64.
+ unsigned long result = 0; // NOLINT(runtime/int)
+ if (_BitScanReverse64(&result, x)) {
+ return 63 - result;
+ }
+ return 64;
+#elif defined(_MSC_VER) && !defined(__clang__)
+ // MSVC does not have __buitin_clzll. Compose two calls to _BitScanReverse
+ unsigned long result = 0; // NOLINT(runtime/int)
+ if ((x >> 32) &&
+ _BitScanReverse(&result, static_cast<unsigned long>(x >> 32))) {
+ return 31 - result;
+ }
+ if (_BitScanReverse(&result, static_cast<unsigned long>(x))) {
+ return 63 - result;
+ }
+ return 64;
+#else
+ int zeroes = 60;
+ if (x >> 32) {
+ zeroes -= 32;
+ x >>= 32;
+ }
+ if (x >> 16) {
+ zeroes -= 16;
+ x >>= 16;
+ }
+ if (x >> 8) {
+ zeroes -= 8;
+ x >>= 8;
+ }
+ if (x >> 4) {
+ zeroes -= 4;
+ x >>= 4;
+ }
+ return "\4\3\2\2\1\1\1\1\0\0\0\0\0\0\0"[x] + zeroes;
+#endif
+}
+
+template <typename T>
+ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CLZ inline int
+CountLeadingZeroes(T x) {
+ static_assert(std::is_unsigned<T>::value, "T must be unsigned");
+ static_assert(IsPowerOf2(std::numeric_limits<T>::digits),
+ "T must have a power-of-2 size");
+ static_assert(sizeof(T) <= sizeof(uint64_t), "T too large");
+ return sizeof(T) <= sizeof(uint16_t)
+ ? CountLeadingZeroes16(static_cast<uint16_t>(x)) -
+ (std::numeric_limits<uint16_t>::digits -
+ std::numeric_limits<T>::digits)
+ : (sizeof(T) <= sizeof(uint32_t)
+ ? CountLeadingZeroes32(static_cast<uint32_t>(x)) -
+ (std::numeric_limits<uint32_t>::digits -
+ std::numeric_limits<T>::digits)
+ : CountLeadingZeroes64(x));
+}
+
+ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CTZ inline int
+CountTrailingZeroesNonzero32(uint32_t x) {
+#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_ctz)
+ static_assert(sizeof(unsigned int) == sizeof(x),
+ "__builtin_ctz does not take 32-bit arg");
+ return __builtin_ctz(x);
+#elif defined(_MSC_VER) && !defined(__clang__)
+ unsigned long result = 0; // NOLINT(runtime/int)
+ _BitScanForward(&result, x);
+ return result;
+#else
+ int c = 31;
+ x &= ~x + 1;
+ if (x & 0x0000FFFF) c -= 16;
+ if (x & 0x00FF00FF) c -= 8;
+ if (x & 0x0F0F0F0F) c -= 4;
+ if (x & 0x33333333) c -= 2;
+ if (x & 0x55555555) c -= 1;
+ return c;
+#endif
+}
+
+ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CTZ inline int
+CountTrailingZeroesNonzero64(uint64_t x) {
+#if ABSL_NUMERIC_INTERNAL_HAVE_BUILTIN_OR_GCC(__builtin_ctzll)
+ static_assert(sizeof(unsigned long long) == sizeof(x), // NOLINT(runtime/int)
+ "__builtin_ctzll does not take 64-bit arg");
+ return __builtin_ctzll(x);
+#elif defined(_MSC_VER) && !defined(__clang__) && \
+ (defined(_M_X64) || defined(_M_ARM64))
+ unsigned long result = 0; // NOLINT(runtime/int)
+ _BitScanForward64(&result, x);
+ return result;
+#elif defined(_MSC_VER) && !defined(__clang__)
+ unsigned long result = 0; // NOLINT(runtime/int)
+ if (static_cast<uint32_t>(x) == 0) {
+ _BitScanForward(&result, static_cast<unsigned long>(x >> 32));
+ return result + 32;
+ }
+ _BitScanForward(&result, static_cast<unsigned long>(x));
+ return result;
+#else
+ int c = 63;
+ x &= ~x + 1;
+ if (x & 0x00000000FFFFFFFF) c -= 32;
+ if (x & 0x0000FFFF0000FFFF) c -= 16;
+ if (x & 0x00FF00FF00FF00FF) c -= 8;
+ if (x & 0x0F0F0F0F0F0F0F0F) c -= 4;
+ if (x & 0x3333333333333333) c -= 2;
+ if (x & 0x5555555555555555) c -= 1;
+ return c;
+#endif
+}
+
+ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CTZ inline int
+CountTrailingZeroesNonzero16(uint16_t x) {
+#if ABSL_HAVE_BUILTIN(__builtin_ctzs)
+ static_assert(sizeof(unsigned short) == sizeof(x), // NOLINT(runtime/int)
+ "__builtin_ctzs does not take 16-bit arg");
+ return __builtin_ctzs(x);
+#else
+ return CountTrailingZeroesNonzero32(x);
+#endif
+}
+
+template <class T>
+ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CTZ inline int
+CountTrailingZeroes(T x) noexcept {
+ static_assert(std::is_unsigned<T>::value, "T must be unsigned");
+ static_assert(IsPowerOf2(std::numeric_limits<T>::digits),
+ "T must have a power-of-2 size");
+ static_assert(sizeof(T) <= sizeof(uint64_t), "T too large");
+ return x == 0 ? std::numeric_limits<T>::digits
+ : (sizeof(T) <= sizeof(uint16_t)
+ ? CountTrailingZeroesNonzero16(static_cast<uint16_t>(x))
+ : (sizeof(T) <= sizeof(uint32_t)
+ ? CountTrailingZeroesNonzero32(
+ static_cast<uint32_t>(x))
+ : CountTrailingZeroesNonzero64(x)));
+}
+
+// If T is narrower than unsigned, T{1} << bit_width will be promoted. We
+// want to force it to wraparound so that bit_ceil of an invalid value are not
+// core constant expressions.
+template <class T>
+ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CLZ inline
+ typename std::enable_if<std::is_unsigned<T>::value, T>::type
+ BitCeilPromotionHelper(T x, T promotion) {
+ return (T{1} << (x + promotion)) >> promotion;
+}
+
+template <class T>
+ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CLZ inline
+ typename std::enable_if<std::is_unsigned<T>::value, T>::type
+ BitCeilNonPowerOf2(T x) {
+ // If T is narrower than unsigned, it undergoes promotion to unsigned when we
+ // shift. We calculate the number of bits added by the wider type.
+ return BitCeilPromotionHelper(
+ static_cast<T>(std::numeric_limits<T>::digits - CountLeadingZeroes(x)),
+ T{sizeof(T) >= sizeof(unsigned) ? 0
+ : std::numeric_limits<unsigned>::digits -
+ std::numeric_limits<T>::digits});
+}
+
+} // namespace numeric_internal
+ABSL_NAMESPACE_END
+} // namespace y_absl
+
+#endif // ABSL_NUMERIC_INTERNAL_BITS_H_
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/internal/representation.h b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/internal/representation.h
index 0761cf39bc..fdc4bf9c59 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/internal/representation.h
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/internal/representation.h
@@ -1,55 +1,55 @@
-// Copyright 2021 The Abseil Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef ABSL_NUMERIC_INTERNAL_REPRESENTATION_H_
-#define ABSL_NUMERIC_INTERNAL_REPRESENTATION_H_
-
-#include <limits>
-
-#include "y_absl/base/config.h"
-
-namespace y_absl {
-ABSL_NAMESPACE_BEGIN
-namespace numeric_internal {
-
-// Returns true iff long double is represented as a pair of doubles added
-// together.
-inline constexpr bool IsDoubleDouble() {
- // A double-double value always has exactly twice the precision of a double
- // value--one double carries the high digits and one double carries the low
- // digits. This property is not shared with any other common floating-point
- // representation, so this test won't trigger false positives. For reference,
- // this table gives the number of bits of precision of each common
- // floating-point representation:
- //
- // type precision
- // IEEE single 24 b
- // IEEE double 53
- // x86 long double 64
- // double-double 106
- // IEEE quadruple 113
- //
- // Note in particular that a quadruple-precision float has greater precision
- // than a double-double float despite taking up the same amount of memory; the
- // quad has more of its bits allocated to the mantissa than the double-double
- // has.
- return std::numeric_limits<long double>::digits ==
- 2 * std::numeric_limits<double>::digits;
-}
-
-} // namespace numeric_internal
-ABSL_NAMESPACE_END
-} // namespace y_absl
-
-#endif // ABSL_NUMERIC_INTERNAL_REPRESENTATION_H_
+// Copyright 2021 The Abseil Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_NUMERIC_INTERNAL_REPRESENTATION_H_
+#define ABSL_NUMERIC_INTERNAL_REPRESENTATION_H_
+
+#include <limits>
+
+#include "y_absl/base/config.h"
+
+namespace y_absl {
+ABSL_NAMESPACE_BEGIN
+namespace numeric_internal {
+
+// Returns true iff long double is represented as a pair of doubles added
+// together.
+inline constexpr bool IsDoubleDouble() {
+ // A double-double value always has exactly twice the precision of a double
+ // value--one double carries the high digits and one double carries the low
+ // digits. This property is not shared with any other common floating-point
+ // representation, so this test won't trigger false positives. For reference,
+ // this table gives the number of bits of precision of each common
+ // floating-point representation:
+ //
+ // type precision
+ // IEEE single 24 b
+ // IEEE double 53
+ // x86 long double 64
+ // double-double 106
+ // IEEE quadruple 113
+ //
+ // Note in particular that a quadruple-precision float has greater precision
+ // than a double-double float despite taking up the same amount of memory; the
+ // quad has more of its bits allocated to the mantissa than the double-double
+ // has.
+ return std::numeric_limits<long double>::digits ==
+ 2 * std::numeric_limits<double>::digits;
+}
+
+} // namespace numeric_internal
+ABSL_NAMESPACE_END
+} // namespace y_absl
+
+#endif // ABSL_NUMERIC_INTERNAL_REPRESENTATION_H_
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/ya.make b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/ya.make
index 9f3280c39d..705b31d2e2 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/ya.make
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/ya.make
@@ -2,15 +2,15 @@
LIBRARY()
-OWNER(
- somov
- g:cpp-contrib
-)
+OWNER(
+ somov
+ g:cpp-contrib
+)
LICENSE(Apache-2.0)
-LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-
+LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
+
ADDINCL(
GLOBAL contrib/restricted/abseil-cpp-tstring
)