diff options
author | armenqa <armenqa@yandex-team.com> | 2024-01-19 12:23:50 +0300 |
---|---|---|
committer | armenqa <armenqa@yandex-team.com> | 2024-01-19 13:10:03 +0300 |
commit | 2de0149d0151c514b22bca0760b95b26c9b0b578 (patch) | |
tree | 2bfed9f3bce7e643ddf048bb61ce3dc0a714bcc2 /contrib/libs/cxxsupp/libcxx/include/__bits | |
parent | a8c06d218f12b2406fbce24d194885c5d7b68503 (diff) | |
download | ydb-2de0149d0151c514b22bca0760b95b26c9b0b578.tar.gz |
feat contrib: aiogram 3
Relates: https://st.yandex-team.ru/, https://st.yandex-team.ru/
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__bits')
-rw-r--r-- | contrib/libs/cxxsupp/libcxx/include/__bits | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__bits b/contrib/libs/cxxsupp/libcxx/include/__bits index c77b5c7850..d2c8439a6b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__bits +++ b/contrib/libs/cxxsupp/libcxx/include/__bits @@ -22,8 +22,6 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -#ifndef _LIBCPP_COMPILER_MSVC - inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR int __libcpp_ctz(unsigned __x) _NOEXCEPT { return __builtin_ctz(__x); } @@ -70,95 +68,6 @@ int __libcpp_popcount(unsigned long __x) _NOEXCEPT { return __builtin_popco inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR int __libcpp_popcount(unsigned long long __x) _NOEXCEPT { return __builtin_popcountll(__x); } -#else // _LIBCPP_COMPILER_MSVC - -// Precondition: __x != 0 -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_ctz(unsigned __x) { - static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); - static_assert(sizeof(unsigned long) == 4, ""); - unsigned long __where; - if (_BitScanForward(&__where, __x)) - return static_cast<int>(__where); - return 32; -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_ctz(unsigned long __x) { - static_assert(sizeof(unsigned long) == sizeof(unsigned), ""); - return __libcpp_ctz(static_cast<unsigned>(__x)); -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_ctz(unsigned long long __x) { - unsigned long __where; -#if defined(_LIBCPP_HAS_BITSCAN64) - if (_BitScanForward64(&__where, __x)) - return static_cast<int>(__where); -#else - // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls. - if (_BitScanForward(&__where, static_cast<unsigned long>(__x))) - return static_cast<int>(__where); - if (_BitScanForward(&__where, static_cast<unsigned long>(__x >> 32))) - return static_cast<int>(__where + 32); -#endif - return 64; -} - -// Precondition: __x != 0 -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_clz(unsigned __x) { - static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); - static_assert(sizeof(unsigned long) == 4, ""); - unsigned long __where; - if (_BitScanReverse(&__where, __x)) - return static_cast<int>(31 - __where); - return 32; // Undefined Behavior. -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_clz(unsigned long __x) { - static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); - return __libcpp_clz(static_cast<unsigned>(__x)); -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_clz(unsigned long long __x) { - unsigned long __where; -#if defined(_LIBCPP_HAS_BITSCAN64) - if (_BitScanReverse64(&__where, __x)) - return static_cast<int>(63 - __where); -#else - // Win32 doesn't have _BitScanReverse64 so emulate it with two 32 bit calls. - if (_BitScanReverse(&__where, static_cast<unsigned long>(__x >> 32))) - return static_cast<int>(63 - (__where + 32)); - if (_BitScanReverse(&__where, static_cast<unsigned long>(__x))) - return static_cast<int>(63 - __where); -#endif - return 64; // Undefined Behavior. -} - -inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned __x) { - static_assert(sizeof(unsigned) == 4, ""); - return __popcnt(__x); -} - -inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long __x) { - static_assert(sizeof(unsigned long) == 4, ""); - return __popcnt(__x); -} - -inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long long __x) { - static_assert(sizeof(unsigned long long) == 8, ""); -#if defined(_M_IX86) - return __popcnt(__x) + __popcnt(__x >> 32); -#else - return __popcnt64(__x); -#endif -} - -#endif // _LIBCPP_COMPILER_MSVC - _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS |