From 8cace3f05003c6cb4d38c36890055f03151c2ad4 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Fri, 16 Oct 2026 02:39:56 +0800 Subject: Remove old code Signed-off-by: Richard Qin --- .../include/c++/v1/__charconv/chars_format.h | 61 ---- .../c++/v1/__charconv/from_chars_floating_point.h | 73 ----- .../c++/v1/__charconv/from_chars_integral.h | 237 -------------- .../include/c++/v1/__charconv/from_chars_result.h | 39 --- .../libcxx/include/c++/v1/__charconv/tables.h | 159 ---------- .../libcxx/include/c++/v1/__charconv/to_chars.h | 25 -- .../include/c++/v1/__charconv/to_chars_base_10.h | 184 ----------- .../c++/v1/__charconv/to_chars_floating_point.h | 55 ---- .../include/c++/v1/__charconv/to_chars_integral.h | 344 --------------------- .../include/c++/v1/__charconv/to_chars_result.h | 48 --- .../libcxx/include/c++/v1/__charconv/traits.h | 167 ---------- 11 files changed, 1392 deletions(-) delete mode 100644 third_party/libcxx/include/c++/v1/__charconv/chars_format.h delete mode 100644 third_party/libcxx/include/c++/v1/__charconv/from_chars_floating_point.h delete mode 100644 third_party/libcxx/include/c++/v1/__charconv/from_chars_integral.h delete mode 100644 third_party/libcxx/include/c++/v1/__charconv/from_chars_result.h delete mode 100644 third_party/libcxx/include/c++/v1/__charconv/tables.h delete mode 100644 third_party/libcxx/include/c++/v1/__charconv/to_chars.h delete mode 100644 third_party/libcxx/include/c++/v1/__charconv/to_chars_base_10.h delete mode 100644 third_party/libcxx/include/c++/v1/__charconv/to_chars_floating_point.h delete mode 100644 third_party/libcxx/include/c++/v1/__charconv/to_chars_integral.h delete mode 100644 third_party/libcxx/include/c++/v1/__charconv/to_chars_result.h delete mode 100644 third_party/libcxx/include/c++/v1/__charconv/traits.h (limited to 'third_party/libcxx/include/c++/v1/__charconv') diff --git a/third_party/libcxx/include/c++/v1/__charconv/chars_format.h b/third_party/libcxx/include/c++/v1/__charconv/chars_format.h deleted file mode 100644 index c76cebd..0000000 --- a/third_party/libcxx/include/c++/v1/__charconv/chars_format.h +++ /dev/null @@ -1,61 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___CHARCONV_CHARS_FORMAT_H -#define _LIBCPP___CHARCONV_CHARS_FORMAT_H - -#include <__config> -#include <__utility/to_underlying.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 - -enum class chars_format { scientific = 0x1, fixed = 0x2, hex = 0x4, general = fixed | scientific }; - -inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format operator~(chars_format __x) { - return chars_format(~std::__to_underlying(__x)); -} - -inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format operator&(chars_format __x, chars_format __y) { - return chars_format(std::__to_underlying(__x) & std::__to_underlying(__y)); -} - -inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format operator|(chars_format __x, chars_format __y) { - return chars_format(std::__to_underlying(__x) | std::__to_underlying(__y)); -} - -inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format operator^(chars_format __x, chars_format __y) { - return chars_format(std::__to_underlying(__x) ^ std::__to_underlying(__y)); -} - -inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format& operator&=(chars_format& __x, chars_format __y) { - __x = __x & __y; - return __x; -} - -inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format& operator|=(chars_format& __x, chars_format __y) { - __x = __x | __y; - return __x; -} - -inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format& operator^=(chars_format& __x, chars_format __y) { - __x = __x ^ __y; - return __x; -} - -#endif // _LIBCPP_STD_VER >= 17 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___CHARCONV_CHARS_FORMAT_H diff --git a/third_party/libcxx/include/c++/v1/__charconv/from_chars_floating_point.h b/third_party/libcxx/include/c++/v1/__charconv/from_chars_floating_point.h deleted file mode 100644 index 811e518..0000000 --- a/third_party/libcxx/include/c++/v1/__charconv/from_chars_floating_point.h +++ /dev/null @@ -1,73 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___CHARCONV_FROM_CHARS_FLOATING_POINT_H -#define _LIBCPP___CHARCONV_FROM_CHARS_FLOATING_POINT_H - -#include <__assert> -#include <__charconv/chars_format.h> -#include <__charconv/from_chars_result.h> -#include <__config> -#include <__cstddef/ptrdiff_t.h> -#include <__system_error/errc.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 - -template -struct __from_chars_result { - _Fp __value; - ptrdiff_t __n; - errc __ec; -}; - -template -_LIBCPP_EXPORTED_FROM_ABI __from_chars_result<_Fp> __from_chars_floating_point( - _LIBCPP_NOESCAPE const char* __first, _LIBCPP_NOESCAPE const char* __last, chars_format __fmt); - -extern template __from_chars_result __from_chars_floating_point( - _LIBCPP_NOESCAPE const char* __first, _LIBCPP_NOESCAPE const char* __last, chars_format __fmt); - -extern template __from_chars_result __from_chars_floating_point( - _LIBCPP_NOESCAPE const char* __first, _LIBCPP_NOESCAPE const char* __last, chars_format __fmt); - -template -_LIBCPP_HIDE_FROM_ABI from_chars_result -__from_chars(const char* __first, const char* __last, _Fp& __value, chars_format __fmt) { - __from_chars_result<_Fp> __r = std::__from_chars_floating_point<_Fp>(__first, __last, __fmt); - if (__r.__ec != errc::invalid_argument) - __value = __r.__value; - return {__first + __r.__n, __r.__ec}; -} - -_LIBCPP_AVAILABILITY_FROM_CHARS_FLOATING_POINT _LIBCPP_HIDE_FROM_ABI inline from_chars_result -from_chars(const char* __first, const char* __last, float& __value, chars_format __fmt = chars_format::general) { - return std::__from_chars(__first, __last, __value, __fmt); -} - -_LIBCPP_AVAILABILITY_FROM_CHARS_FLOATING_POINT _LIBCPP_HIDE_FROM_ABI inline from_chars_result -from_chars(const char* __first, const char* __last, double& __value, chars_format __fmt = chars_format::general) { - return std::__from_chars(__first, __last, __value, __fmt); -} - -#endif // _LIBCPP_STD_VER >= 17 - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___CHARCONV_FROM_CHARS_FLOATING_POINT_H diff --git a/third_party/libcxx/include/c++/v1/__charconv/from_chars_integral.h b/third_party/libcxx/include/c++/v1/__charconv/from_chars_integral.h deleted file mode 100644 index 3063c09..0000000 --- a/third_party/libcxx/include/c++/v1/__charconv/from_chars_integral.h +++ /dev/null @@ -1,237 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___CHARCONV_FROM_CHARS_INTEGRAL_H -#define _LIBCPP___CHARCONV_FROM_CHARS_INTEGRAL_H - -#include <__assert> -#include <__charconv/from_chars_result.h> -#include <__charconv/traits.h> -#include <__config> -#include <__system_error/errc.h> -#include <__type_traits/enable_if.h> -#include <__type_traits/is_integral.h> -#include <__type_traits/is_signed.h> -#include <__type_traits/is_unsigned.h> -#include <__type_traits/make_unsigned.h> -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 - -from_chars_result from_chars(const char*, const char*, bool, int = 10) = delete; - -template -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -__sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args) { - using __tl = numeric_limits<_Tp>; - decltype(std::__to_unsigned_like(__value)) __x; - - bool __neg = (__first != __last && *__first == '-'); - auto __r = __f(__neg ? __first + 1 : __first, __last, __x, __args...); - switch (__r.ec) { - case errc::invalid_argument: - return {__first, __r.ec}; - case errc::result_out_of_range: - return __r; - default: - break; - } - - if (__neg) { - if (__x <= std::__complement(std::__to_unsigned_like(__tl::min()))) { - __value = std::__complement(__x); - return __r; - } - } else { - if (__x <= std::__to_unsigned_like(__tl::max())) { - __value = __x; - return __r; - } - } - - return {__r.ptr, errc::result_out_of_range}; -} - -template -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool __in_pattern(_Tp __c) { - return '0' <= __c && __c <= '9'; -} - -struct _LIBCPP_HIDDEN __in_pattern_result { - bool __ok; - int __val; - - explicit _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI operator bool() const { return __ok; } -}; - -template -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __in_pattern_result __in_pattern(_Tp __c, int __base) { - if (__base <= 10) - return {'0' <= __c && __c < '0' + __base, __c - '0'}; - else if (std::__in_pattern(__c)) - return {true, __c - '0'}; - else if ('a' <= __c && __c < 'a' + __base - 10) - return {true, __c - 'a' + 10}; - else - return {'A' <= __c && __c < 'A' + __base - 10, __c - 'A' + 10}; -} - -template -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -__subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args) { - auto __find_non_zero = [](_It __firstit, _It __lastit) { - for (; __firstit != __lastit; ++__firstit) - if (*__firstit != '0') - break; - return __firstit; - }; - - auto __p = __find_non_zero(__first, __last); - if (__p == __last || !std::__in_pattern(*__p, __args...)) { - if (__p == __first) - return {__first, errc::invalid_argument}; - else { - __value = 0; - return {__p, {}}; - } - } - - auto __r = __f(__p, __last, __value, __args...); - if (__r.ec == errc::result_out_of_range) { - for (; __r.ptr != __last; ++__r.ptr) { - if (!std::__in_pattern(*__r.ptr, __args...)) - break; - } - } - - return __r; -} - -template ::value, int> = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -__from_chars_atoi(const char* __first, const char* __last, _Tp& __value) { - using __tx = __itoa::__traits<_Tp>; - using __output_type = typename __tx::type; - - return std::__subject_seq_combinator( - __first, __last, __value, [](const char* __f, const char* __l, _Tp& __val) -> from_chars_result { - __output_type __a, __b; - auto __p = __tx::__read(__f, __l, __a, __b); - if (__p == __l || !std::__in_pattern(*__p)) { - __output_type __m = numeric_limits<_Tp>::max(); - if (__m >= __a && __m - __a >= __b) { - __val = __a + __b; - return {__p, {}}; - } - } - return {__p, errc::result_out_of_range}; - }); -} - -template ::value, int> = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -__from_chars_atoi(const char* __first, const char* __last, _Tp& __value) { - using __t = decltype(std::__to_unsigned_like(__value)); - return std::__sign_combinator(__first, __last, __value, __from_chars_atoi<__t>); -} - -/* -// Code used to generate __from_chars_log2f_lut. -#include -#include -#include - -int main() { - for (int i = 2; i <= 36; ++i) - std::cout << std::format("{},\n", log2f(i)); -} -*/ -/// log2f table for bases [2, 36]. -inline constexpr float __from_chars_log2f_lut[35] = { - 1, 1.5849625, 2, 2.321928, 2.5849626, 2.807355, 3, 3.169925, 3.321928, - 3.4594316, 3.5849626, 3.7004397, 3.807355, 3.9068906, 4, 4.087463, 4.169925, 4.2479277, - 4.321928, 4.3923173, 4.4594316, 4.523562, 4.5849624, 4.643856, 4.70044, 4.7548876, 4.807355, - 4.857981, 4.9068904, 4.9541965, 5, 5.044394, 5.087463, 5.129283, 5.169925}; - -template ::value, int> = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -__from_chars_integral(const char* __first, const char* __last, _Tp& __value, int __base) { - if (__base == 10) - return std::__from_chars_atoi(__first, __last, __value); - - return std::__subject_seq_combinator( - __first, - __last, - __value, - [](const char* __p, const char* __lastp, _Tp& __val, int __b) -> from_chars_result { - using __tl = numeric_limits<_Tp>; - // __base is always between 2 and 36 inclusive. - auto __digits = __tl::digits / __from_chars_log2f_lut[__b - 2]; - _Tp __x = __in_pattern(*__p++, __b).__val, __y = 0; - - for (int __i = 1; __p != __lastp; ++__i, ++__p) { - if (auto __c = __in_pattern(*__p, __b)) { - if (__i < __digits - 1) - __x = __x * __b + __c.__val; - else { - if (!__itoa::__mul_overflowed(__x, __b, __x)) - ++__p; - __y = __c.__val; - break; - } - } else - break; - } - - if (__p == __lastp || !__in_pattern(*__p, __b)) { - if (__tl::max() - __x >= __y) { - __val = __x + __y; - return {__p, {}}; - } - } - return {__p, errc::result_out_of_range}; - }, - __base); -} - -template ::value, int> = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -__from_chars_integral(const char* __first, const char* __last, _Tp& __value, int __base) { - using __t = decltype(std::__to_unsigned_like(__value)); - return std::__sign_combinator(__first, __last, __value, __from_chars_integral<__t>, __base); -} - -template ::value, int> = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -from_chars(const char* __first, const char* __last, _Tp& __value) { - return std::__from_chars_atoi(__first, __last, __value); -} - -template ::value, int> = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -from_chars(const char* __first, const char* __last, _Tp& __value, int __base) { - _LIBCPP_ASSERT_UNCATEGORIZED(2 <= __base && __base <= 36, "base not in [2, 36]"); - return std::__from_chars_integral(__first, __last, __value, __base); -} -#endif // _LIBCPP_STD_VER >= 17 - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___CHARCONV_FROM_CHARS_INTEGRAL_H diff --git a/third_party/libcxx/include/c++/v1/__charconv/from_chars_result.h b/third_party/libcxx/include/c++/v1/__charconv/from_chars_result.h deleted file mode 100644 index b4ecea3..0000000 --- a/third_party/libcxx/include/c++/v1/__charconv/from_chars_result.h +++ /dev/null @@ -1,39 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___CHARCONV_FROM_CHARS_RESULT_H -#define _LIBCPP___CHARCONV_FROM_CHARS_RESULT_H - -#include <__config> -#include <__system_error/errc.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 - -struct from_chars_result { - const char* ptr; - errc ec; -# if _LIBCPP_STD_VER >= 20 - _LIBCPP_HIDE_FROM_ABI friend bool operator==(const from_chars_result&, const from_chars_result&) = default; -# endif -# if _LIBCPP_STD_VER >= 26 - _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return ec == errc{}; } -# endif -}; - -#endif // _LIBCPP_STD_VER >= 17 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___CHARCONV_FROM_CHARS_RESULT_H diff --git a/third_party/libcxx/include/c++/v1/__charconv/tables.h b/third_party/libcxx/include/c++/v1/__charconv/tables.h deleted file mode 100644 index b8c6fd8..0000000 --- a/third_party/libcxx/include/c++/v1/__charconv/tables.h +++ /dev/null @@ -1,159 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___CHARCONV_TABLES -#define _LIBCPP___CHARCONV_TABLES - -#include <__config> -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -namespace __itoa { - -inline _LIBCPP_CONSTEXPR const char __base_2_lut[64] = { - '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '1', '0', '0', '0', '1', '1', '0', '1', '0', '0', '0', '1', - '0', '1', '0', '1', '1', '0', '0', '1', '1', '1', '1', '0', '0', '0', '1', '0', '0', '1', '1', '0', '1', '0', - '1', '0', '1', '1', '1', '1', '0', '0', '1', '1', '0', '1', '1', '1', '1', '0', '1', '1', '1', '1'}; - -inline _LIBCPP_CONSTEXPR const char __base_8_lut[128] = { - '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '1', '0', '1', '1', '1', '2', - '1', '3', '1', '4', '1', '5', '1', '6', '1', '7', '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', '2', '5', - '2', '6', '2', '7', '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '4', '0', - '4', '1', '4', '2', '4', '3', '4', '4', '4', '5', '4', '6', '4', '7', '5', '0', '5', '1', '5', '2', '5', '3', - '5', '4', '5', '5', '5', '6', '5', '7', '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', - '6', '7', '7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6', '7', '7'}; - -inline _LIBCPP_CONSTEXPR const char __base_16_lut[512] = { - '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9', '0', 'a', '0', - 'b', '0', 'c', '0', 'd', '0', 'e', '0', 'f', '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6', - '1', '7', '1', '8', '1', '9', '1', 'a', '1', 'b', '1', 'c', '1', 'd', '1', 'e', '1', 'f', '2', '0', '2', '1', '2', - '2', '2', '3', '2', '4', '2', '5', '2', '6', '2', '7', '2', '8', '2', '9', '2', 'a', '2', 'b', '2', 'c', '2', 'd', - '2', 'e', '2', 'f', '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '3', '8', '3', - '9', '3', 'a', '3', 'b', '3', 'c', '3', 'd', '3', 'e', '3', 'f', '4', '0', '4', '1', '4', '2', '4', '3', '4', '4', - '4', '5', '4', '6', '4', '7', '4', '8', '4', '9', '4', 'a', '4', 'b', '4', 'c', '4', 'd', '4', 'e', '4', 'f', '5', - '0', '5', '1', '5', '2', '5', '3', '5', '4', '5', '5', '5', '6', '5', '7', '5', '8', '5', '9', '5', 'a', '5', 'b', - '5', 'c', '5', 'd', '5', 'e', '5', 'f', '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', '6', - '7', '6', '8', '6', '9', '6', 'a', '6', 'b', '6', 'c', '6', 'd', '6', 'e', '6', 'f', '7', '0', '7', '1', '7', '2', - '7', '3', '7', '4', '7', '5', '7', '6', '7', '7', '7', '8', '7', '9', '7', 'a', '7', 'b', '7', 'c', '7', 'd', '7', - 'e', '7', 'f', '8', '0', '8', '1', '8', '2', '8', '3', '8', '4', '8', '5', '8', '6', '8', '7', '8', '8', '8', '9', - '8', 'a', '8', 'b', '8', 'c', '8', 'd', '8', 'e', '8', 'f', '9', '0', '9', '1', '9', '2', '9', '3', '9', '4', '9', - '5', '9', '6', '9', '7', '9', '8', '9', '9', '9', 'a', '9', 'b', '9', 'c', '9', 'd', '9', 'e', '9', 'f', 'a', '0', - 'a', '1', 'a', '2', 'a', '3', 'a', '4', 'a', '5', 'a', '6', 'a', '7', 'a', '8', 'a', '9', 'a', 'a', 'a', 'b', 'a', - 'c', 'a', 'd', 'a', 'e', 'a', 'f', 'b', '0', 'b', '1', 'b', '2', 'b', '3', 'b', '4', 'b', '5', 'b', '6', 'b', '7', - 'b', '8', 'b', '9', 'b', 'a', 'b', 'b', 'b', 'c', 'b', 'd', 'b', 'e', 'b', 'f', 'c', '0', 'c', '1', 'c', '2', 'c', - '3', 'c', '4', 'c', '5', 'c', '6', 'c', '7', 'c', '8', 'c', '9', 'c', 'a', 'c', 'b', 'c', 'c', 'c', 'd', 'c', 'e', - 'c', 'f', 'd', '0', 'd', '1', 'd', '2', 'd', '3', 'd', '4', 'd', '5', 'd', '6', 'd', '7', 'd', '8', 'd', '9', 'd', - 'a', 'd', 'b', 'd', 'c', 'd', 'd', 'd', 'e', 'd', 'f', 'e', '0', 'e', '1', 'e', '2', 'e', '3', 'e', '4', 'e', '5', - 'e', '6', 'e', '7', 'e', '8', 'e', '9', 'e', 'a', 'e', 'b', 'e', 'c', 'e', 'd', 'e', 'e', 'e', 'f', 'f', '0', 'f', - '1', 'f', '2', 'f', '3', 'f', '4', 'f', '5', 'f', '6', 'f', '7', 'f', '8', 'f', '9', 'f', 'a', 'f', 'b', 'f', 'c', - 'f', 'd', 'f', 'e', 'f', 'f'}; - -inline _LIBCPP_CONSTEXPR const uint32_t __pow10_32[10] = { - UINT32_C(0), - UINT32_C(10), - UINT32_C(100), - UINT32_C(1000), - UINT32_C(10000), - UINT32_C(100000), - UINT32_C(1000000), - UINT32_C(10000000), - UINT32_C(100000000), - UINT32_C(1000000000)}; - -inline _LIBCPP_CONSTEXPR const uint64_t __pow10_64[20] = { - UINT64_C(0), - UINT64_C(10), - UINT64_C(100), - UINT64_C(1000), - UINT64_C(10000), - UINT64_C(100000), - UINT64_C(1000000), - UINT64_C(10000000), - UINT64_C(100000000), - UINT64_C(1000000000), - UINT64_C(10000000000), - UINT64_C(100000000000), - UINT64_C(1000000000000), - UINT64_C(10000000000000), - UINT64_C(100000000000000), - UINT64_C(1000000000000000), - UINT64_C(10000000000000000), - UINT64_C(100000000000000000), - UINT64_C(1000000000000000000), - UINT64_C(10000000000000000000)}; - -# if _LIBCPP_HAS_INT128 -inline _LIBCPP_CONSTEXPR const int __pow10_128_offset = 0; -inline _LIBCPP_CONSTEXPR const __uint128_t __pow10_128[40] = { - UINT64_C(0), - UINT64_C(10), - UINT64_C(100), - UINT64_C(1000), - UINT64_C(10000), - UINT64_C(100000), - UINT64_C(1000000), - UINT64_C(10000000), - UINT64_C(100000000), - UINT64_C(1000000000), - UINT64_C(10000000000), - UINT64_C(100000000000), - UINT64_C(1000000000000), - UINT64_C(10000000000000), - UINT64_C(100000000000000), - UINT64_C(1000000000000000), - UINT64_C(10000000000000000), - UINT64_C(100000000000000000), - UINT64_C(1000000000000000000), - UINT64_C(10000000000000000000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(100), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(1000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(100000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(1000000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(100000000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(1000000000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000000000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(100000000000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(1000000000000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000000000000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(100000000000000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(1000000000000000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000000000000000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(100000000000000000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(1000000000000000000), - __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000000000000000000), - (__uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000000000000000000)) * 10}; -# endif - -inline _LIBCPP_CONSTEXPR const char __digits_base_10[200] = { - // clang-format off - '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9', - '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6', '1', '7', '1', '8', '1', '9', - '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', '2', '5', '2', '6', '2', '7', '2', '8', '2', '9', - '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '3', '8', '3', '9', - '4', '0', '4', '1', '4', '2', '4', '3', '4', '4', '4', '5', '4', '6', '4', '7', '4', '8', '4', '9', - '5', '0', '5', '1', '5', '2', '5', '3', '5', '4', '5', '5', '5', '6', '5', '7', '5', '8', '5', '9', - '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', '6', '7', '6', '8', '6', '9', - '7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6', '7', '7', '7', '8', '7', '9', - '8', '0', '8', '1', '8', '2', '8', '3', '8', '4', '8', '5', '8', '6', '8', '7', '8', '8', '8', '9', - '9', '0', '9', '1', '9', '2', '9', '3', '9', '4', '9', '5', '9', '6', '9', '7', '9', '8', '9', '9'}; -// clang-format on - -} // namespace __itoa - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___CHARCONV_TABLES diff --git a/third_party/libcxx/include/c++/v1/__charconv/to_chars.h b/third_party/libcxx/include/c++/v1/__charconv/to_chars.h deleted file mode 100644 index 8ef09af..0000000 --- a/third_party/libcxx/include/c++/v1/__charconv/to_chars.h +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___CHARCONV_TO_CHARS -#define _LIBCPP___CHARCONV_TO_CHARS - -#include <__charconv/to_chars_floating_point.h> -#include <__charconv/to_chars_integral.h> -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___CHARCONV_TO_CHARS diff --git a/third_party/libcxx/include/c++/v1/__charconv/to_chars_base_10.h b/third_party/libcxx/include/c++/v1/__charconv/to_chars_base_10.h deleted file mode 100644 index d90952e..0000000 --- a/third_party/libcxx/include/c++/v1/__charconv/to_chars_base_10.h +++ /dev/null @@ -1,184 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___CHARCONV_TO_CHARS_BASE_10_H -#define _LIBCPP___CHARCONV_TO_CHARS_BASE_10_H - -#include <__algorithm/copy_n.h> -#include <__assert> -#include <__charconv/tables.h> -#include <__config> -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -namespace __itoa { - -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append1(char* __first, uint32_t __value) _NOEXCEPT { - *__first = '0' + static_cast(__value); - return __first + 1; -} - -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append2(char* __first, uint32_t __value) _NOEXCEPT { - return std::copy_n(&__digits_base_10[__value * 2], 2, __first); -} - -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append3(char* __first, uint32_t __value) _NOEXCEPT { - return __itoa::__append2(__itoa::__append1(__first, __value / 100), __value % 100); -} - -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append4(char* __first, uint32_t __value) _NOEXCEPT { - return __itoa::__append2(__itoa::__append2(__first, __value / 100), __value % 100); -} - -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append5(char* __first, uint32_t __value) _NOEXCEPT { - return __itoa::__append4(__itoa::__append1(__first, __value / 10000), __value % 10000); -} - -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append6(char* __first, uint32_t __value) _NOEXCEPT { - return __itoa::__append4(__itoa::__append2(__first, __value / 10000), __value % 10000); -} - -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append7(char* __first, uint32_t __value) _NOEXCEPT { - return __itoa::__append6(__itoa::__append1(__first, __value / 1000000), __value % 1000000); -} - -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append8(char* __first, uint32_t __value) _NOEXCEPT { - return __itoa::__append6(__itoa::__append2(__first, __value / 1000000), __value % 1000000); -} - -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append9(char* __first, uint32_t __value) _NOEXCEPT { - return __itoa::__append8(__itoa::__append1(__first, __value / 100000000), __value % 100000000); -} - -template -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __append10(char* __first, _Tp __value) _NOEXCEPT { - return __itoa::__append8(__itoa::__append2(__first, static_cast(__value / 100000000)), - static_cast(__value % 100000000)); -} - -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* -__base_10_u32(char* __first, uint32_t __value) _NOEXCEPT { - if (__value < 1000000) { - if (__value < 10000) { - if (__value < 100) { - // 0 <= __value < 100 - if (__value < 10) - return __itoa::__append1(__first, __value); - return __itoa::__append2(__first, __value); - } - // 100 <= __value < 10'000 - if (__value < 1000) - return __itoa::__append3(__first, __value); - return __itoa::__append4(__first, __value); - } - - // 10'000 <= __value < 1'000'000 - if (__value < 100000) - return __itoa::__append5(__first, __value); - return __itoa::__append6(__first, __value); - } - - // __value => 1'000'000 - if (__value < 100000000) { - // 1'000'000 <= __value < 100'000'000 - if (__value < 10000000) - return __itoa::__append7(__first, __value); - return __itoa::__append8(__first, __value); - } - - // 100'000'000 <= __value < max - if (__value < 1000000000) - return __itoa::__append9(__first, __value); - return __itoa::__append10(__first, __value); -} - -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* -__base_10_u64(char* __buffer, uint64_t __value) _NOEXCEPT { - if (__value <= UINT32_MAX) - return __itoa::__base_10_u32(__buffer, static_cast(__value)); - - // Numbers in the range UINT32_MAX <= val < 10'000'000'000 always contain 10 - // digits and are outputted after this if statement. - if (__value >= 10000000000) { - // This function properly deterimines the first non-zero leading digit. - __buffer = __itoa::__base_10_u32(__buffer, static_cast(__value / 10000000000)); - __value %= 10000000000; - } - return __itoa::__append10(__buffer, __value); -} - -# if _LIBCPP_HAS_INT128 -/// \returns 10^\a exp -/// -/// \pre \a exp [19, 39] -/// -/// \note The lookup table contains a partial set of exponents limiting the -/// range that can be used. However the range is sufficient for -/// \ref __base_10_u128. -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline __uint128_t __pow_10(int __exp) _NOEXCEPT { - _LIBCPP_ASSERT_INTERNAL(__exp >= __pow10_128_offset, "Index out of bounds"); - return __pow10_128[__exp - __pow10_128_offset]; -} - -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* -__base_10_u128(char* __buffer, __uint128_t __value) _NOEXCEPT { - _LIBCPP_ASSERT_INTERNAL( - __value > numeric_limits::max(), "The optimizations for this algorithm fails when this isn't true."); - - // Unlike the 64 to 32 bit case the 128 bit case the "upper half" can't be - // stored in the "lower half". Instead we first need to handle the top most - // digits separately. - // - // Maximum unsigned values - // 64 bit 18'446'744'073'709'551'615 (20 digits) - // 128 bit 340'282'366'920'938'463'463'374'607'431'768'211'455 (39 digits) - // step 1 ^ ([0-1] digits) - // step 2 ^^^^^^^^^^^^^^^^^^^^^^^^^ ([0-19] digits) - // step 3 ^^^^^^^^^^^^^^^^^^^^^^^^^ (19 digits) - if (__value >= __itoa::__pow_10(38)) { - // step 1 - __buffer = __itoa::__append1(__buffer, static_cast(__value / __itoa::__pow_10(38))); - __value %= __itoa::__pow_10(38); - - // step 2 always 19 digits. - // They are handled here since leading zeros need to be appended to the buffer, - __buffer = __itoa::__append9(__buffer, static_cast(__value / __itoa::__pow_10(29))); - __value %= __itoa::__pow_10(29); - __buffer = __itoa::__append10(__buffer, static_cast(__value / __itoa::__pow_10(19))); - __value %= __itoa::__pow_10(19); - } else { - // step 2 - // This version needs to determine the position of the leading non-zero digit. - __buffer = __base_10_u64(__buffer, static_cast(__value / __itoa::__pow_10(19))); - __value %= __itoa::__pow_10(19); - } - - // Step 3 - __buffer = __itoa::__append9(__buffer, static_cast(__value / 10000000000)); - __buffer = __itoa::__append10(__buffer, static_cast(__value % 10000000000)); - - return __buffer; -} -# endif -} // namespace __itoa - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___CHARCONV_TO_CHARS_BASE_10_H diff --git a/third_party/libcxx/include/c++/v1/__charconv/to_chars_floating_point.h b/third_party/libcxx/include/c++/v1/__charconv/to_chars_floating_point.h deleted file mode 100644 index 118f316..0000000 --- a/third_party/libcxx/include/c++/v1/__charconv/to_chars_floating_point.h +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___CHARCONV_TO_CHARS_FLOATING_POINT_H -#define _LIBCPP___CHARCONV_TO_CHARS_FLOATING_POINT_H - -#include <__charconv/chars_format.h> -#include <__charconv/to_chars_result.h> -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result -to_chars(char* __first, char* __last, float __value); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result -to_chars(char* __first, char* __last, double __value); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result -to_chars(char* __first, char* __last, long double __value); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result -to_chars(char* __first, char* __last, float __value, chars_format __fmt); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result -to_chars(char* __first, char* __last, double __value, chars_format __fmt); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result -to_chars(char* __first, char* __last, long double __value, chars_format __fmt); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result -to_chars(char* __first, char* __last, float __value, chars_format __fmt, int __precision); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result -to_chars(char* __first, char* __last, double __value, chars_format __fmt, int __precision); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result -to_chars(char* __first, char* __last, long double __value, chars_format __fmt, int __precision); -#endif // _LIBCPP_STD_VER >= 17 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___CHARCONV_TO_CHARS_FLOATING_POINT_H diff --git a/third_party/libcxx/include/c++/v1/__charconv/to_chars_integral.h b/third_party/libcxx/include/c++/v1/__charconv/to_chars_integral.h deleted file mode 100644 index 6d42513..0000000 --- a/third_party/libcxx/include/c++/v1/__charconv/to_chars_integral.h +++ /dev/null @@ -1,344 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___CHARCONV_TO_CHARS_INTEGRAL_H -#define _LIBCPP___CHARCONV_TO_CHARS_INTEGRAL_H - -#include <__algorithm/copy_n.h> -#include <__assert> -#include <__bit/countl.h> -#include <__charconv/tables.h> -#include <__charconv/to_chars_base_10.h> -#include <__charconv/to_chars_result.h> -#include <__charconv/traits.h> -#include <__config> -#include <__cstddef/ptrdiff_t.h> -#include <__system_error/errc.h> -#include <__type_traits/enable_if.h> -#include <__type_traits/integral_constant.h> -#include <__type_traits/is_integral.h> -#include <__type_traits/is_same.h> -#include <__type_traits/is_signed.h> -#include <__type_traits/make_32_64_or_128_bit.h> -#include <__type_traits/make_unsigned.h> -#include <__utility/unreachable.h> -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -template -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result -__to_chars_itoa(char* __first, char* __last, _Tp __value, false_type); - -template -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result -__to_chars_itoa(char* __first, char* __last, _Tp __value, true_type) { - auto __x = std::__to_unsigned_like(__value); - if (__value < 0 && __first != __last) { - *__first++ = '-'; - __x = std::__complement(__x); - } - - return std::__to_chars_itoa(__first, __last, __x, false_type()); -} - -template -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result -__to_chars_itoa(char* __first, char* __last, _Tp __value, false_type) { - using __tx = __itoa::__traits<_Tp>; - auto __diff = __last - __first; - - if (__tx::digits <= __diff || __tx::__width(__value) <= __diff) - return {__tx::__convert(__first, __value), errc(0)}; - else - return {__last, errc::value_too_large}; -} - -# if _LIBCPP_HAS_INT128 -template <> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result -__to_chars_itoa(char* __first, char* __last, __uint128_t __value, false_type) { - // When the value fits in 64-bits use the 64-bit code path. This reduces - // the number of expensive calculations on 128-bit values. - // - // NOTE the 128-bit code path requires this optimization. - if (__value <= numeric_limits::max()) - return __to_chars_itoa(__first, __last, static_cast(__value), false_type()); - - using __tx = __itoa::__traits<__uint128_t>; - auto __diff = __last - __first; - - if (__tx::digits <= __diff || __tx::__width(__value) <= __diff) - return {__tx::__convert(__first, __value), errc(0)}; - else - return {__last, errc::value_too_large}; -} -# endif - -template ::value, int> = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result -__to_chars_integral(char* __first, char* __last, _Tp __value, int __base); - -template ::value, int> = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result -__to_chars_integral(char* __first, char* __last, _Tp __value, int __base) { - auto __x = std::__to_unsigned_like(__value); - if (__value < 0 && __first != __last) { - *__first++ = '-'; - __x = std::__complement(__x); - } - - return std::__to_chars_integral(__first, __last, __x, __base); -} - -namespace __itoa { - -template -struct _LIBCPP_HIDDEN __integral; - -template <> -struct _LIBCPP_HIDDEN __integral<2> { - template - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR int __width(_Tp __value) _NOEXCEPT { - // If value == 0 still need one digit. If the value != this has no - // effect since the code scans for the most significant bit set. - return numeric_limits<_Tp>::digits - std::__countl_zero(__value | 1); - } - - template - _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static __to_chars_result - __to_chars(char* __first, char* __last, _Tp __value) { - ptrdiff_t __cap = __last - __first; - int __n = __width(__value); - if (__n > __cap) - return {__last, errc::value_too_large}; - - __last = __first + __n; - char* __p = __last; - const unsigned __divisor = 16; - while (__value > __divisor) { - unsigned __c = __value % __divisor; - __value /= __divisor; - __p -= 4; - std::copy_n(&__base_2_lut[4 * __c], 4, __p); - } - do { - unsigned __c = __value % 2; - __value /= 2; - *--__p = "01"[__c]; - } while (__value != 0); - return {__last, errc(0)}; - } -}; - -template <> -struct _LIBCPP_HIDDEN __integral<8> { - template - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR int __width(_Tp __value) _NOEXCEPT { - // If value == 0 still need one digit. If the value != this has no - // effect since the code scans for the most significat bit set. - return ((numeric_limits<_Tp>::digits - std::__countl_zero(__value | 1)) + 2) / 3; - } - - template - _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static __to_chars_result - __to_chars(char* __first, char* __last, _Tp __value) { - ptrdiff_t __cap = __last - __first; - int __n = __width(__value); - if (__n > __cap) - return {__last, errc::value_too_large}; - - __last = __first + __n; - char* __p = __last; - unsigned __divisor = 64; - while (__value > __divisor) { - unsigned __c = __value % __divisor; - __value /= __divisor; - __p -= 2; - std::copy_n(&__base_8_lut[2 * __c], 2, __p); - } - do { - unsigned __c = __value % 8; - __value /= 8; - *--__p = "01234567"[__c]; - } while (__value != 0); - return {__last, errc(0)}; - } -}; - -template <> -struct _LIBCPP_HIDDEN __integral<16> { - template - _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR int __width(_Tp __value) _NOEXCEPT { - // If value == 0 still need one digit. If the value != this has no - // effect since the code scans for the most significat bit set. - return (numeric_limits<_Tp>::digits - std::__countl_zero(__value | 1) + 3) / 4; - } - - template - _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static __to_chars_result - __to_chars(char* __first, char* __last, _Tp __value) { - ptrdiff_t __cap = __last - __first; - int __n = __width(__value); - if (__n > __cap) - return {__last, errc::value_too_large}; - - __last = __first + __n; - char* __p = __last; - unsigned __divisor = 256; - while (__value > __divisor) { - unsigned __c = __value % __divisor; - __value /= __divisor; - __p -= 2; - std::copy_n(&__base_16_lut[2 * __c], 2, __p); - } - if (__first != __last) - do { - unsigned __c = __value % 16; - __value /= 16; - *--__p = "0123456789abcdef"[__c]; - } while (__value != 0); - return {__last, errc(0)}; - } -}; - -} // namespace __itoa - -template = sizeof(unsigned)), int> = 0> -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __to_chars_integral_width(_Tp __value) { - return __itoa::__integral<_Base>::__width(__value); -} - -template = 0> -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __to_chars_integral_width(_Tp __value) { - return std::__to_chars_integral_width<_Base>(static_cast(__value)); -} - -template = sizeof(unsigned)), int> = 0> -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result -__to_chars_integral(char* __first, char* __last, _Tp __value) { - return __itoa::__integral<_Base>::__to_chars(__first, __last, __value); -} - -template = 0> -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result -__to_chars_integral(char* __first, char* __last, _Tp __value) { - return std::__to_chars_integral<_Base>(__first, __last, static_cast(__value)); -} - -template -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __to_chars_integral_width(_Tp __value, unsigned __base) { - _LIBCPP_ASSERT_INTERNAL(__value >= 0, "The function requires a non-negative value."); - - unsigned __base_2 = __base * __base; - unsigned __base_3 = __base_2 * __base; - unsigned __base_4 = __base_2 * __base_2; - - int __r = 0; - while (true) { - if (__value < __base) - return __r + 1; - if (__value < __base_2) - return __r + 2; - if (__value < __base_3) - return __r + 3; - if (__value < __base_4) - return __r + 4; - - __value /= __base_4; - __r += 4; - } - - __libcpp_unreachable(); -} - -template ::value, int> > -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result -__to_chars_integral(char* __first, char* __last, _Tp __value, int __base) { - if (__base == 10) [[likely]] - return std::__to_chars_itoa(__first, __last, __value, false_type()); - - switch (__base) { - case 2: - return std::__to_chars_integral<2>(__first, __last, __value); - case 8: - return std::__to_chars_integral<8>(__first, __last, __value); - case 16: - return std::__to_chars_integral<16>(__first, __last, __value); - } - - ptrdiff_t __cap = __last - __first; - int __n = std::__to_chars_integral_width(__value, __base); - if (__n > __cap) - return {__last, errc::value_too_large}; - - __last = __first + __n; - char* __p = __last; - do { - unsigned __c = __value % __base; - __value /= __base; - *--__p = "0123456789abcdefghijklmnopqrstuvwxyz"[__c]; - } while (__value != 0); - return {__last, errc(0)}; -} - -_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 char __hex_to_upper(char __c) { - switch (__c) { - case 'a': - return 'A'; - case 'b': - return 'B'; - case 'c': - return 'C'; - case 'd': - return 'D'; - case 'e': - return 'E'; - case 'f': - return 'F'; - } - return __c; -} - -#if _LIBCPP_STD_VER >= 17 - -to_chars_result to_chars(char*, char*, bool, int = 10) = delete; - -template ::value, int> = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result -to_chars(char* __first, char* __last, _Tp __value) { - using _Type = __make_32_64_or_128_bit_t<_Tp>; - static_assert(!is_same<_Type, void>::value, "unsupported integral type used in to_chars"); - return std::__to_chars_itoa(__first, __last, static_cast<_Type>(__value), is_signed<_Tp>()); -} - -template ::value, int> = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result -to_chars(char* __first, char* __last, _Tp __value, int __base) { - _LIBCPP_ASSERT_UNCATEGORIZED(2 <= __base && __base <= 36, "base not in [2, 36]"); - - using _Type = __make_32_64_or_128_bit_t<_Tp>; - return std::__to_chars_integral(__first, __last, static_cast<_Type>(__value), __base); -} - -#endif // _LIBCPP_STD_VER >= 17 - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___CHARCONV_TO_CHARS_INTEGRAL_H diff --git a/third_party/libcxx/include/c++/v1/__charconv/to_chars_result.h b/third_party/libcxx/include/c++/v1/__charconv/to_chars_result.h deleted file mode 100644 index a3cd4e2..0000000 --- a/third_party/libcxx/include/c++/v1/__charconv/to_chars_result.h +++ /dev/null @@ -1,48 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___CHARCONV_TO_CHARS_RESULT_H -#define _LIBCPP___CHARCONV_TO_CHARS_RESULT_H - -#include <__config> -#include <__system_error/errc.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 - -struct to_chars_result { - char* ptr; - errc ec; -# if _LIBCPP_STD_VER >= 20 - _LIBCPP_HIDE_FROM_ABI friend bool operator==(const to_chars_result&, const to_chars_result&) = default; -# endif -# if _LIBCPP_STD_VER >= 26 - _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return ec == errc{}; } -# endif -}; - -#endif // _LIBCPP_STD_VER >= 17 - -struct __to_chars_result { - char* __ptr; - errc __ec; - -#if _LIBCPP_STD_VER >= 17 - _LIBCPP_HIDE_FROM_ABI constexpr operator to_chars_result() { return {__ptr, __ec}; } -#endif -}; - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___CHARCONV_TO_CHARS_RESULT_H diff --git a/third_party/libcxx/include/c++/v1/__charconv/traits.h b/third_party/libcxx/include/c++/v1/__charconv/traits.h deleted file mode 100644 index b8c840d..0000000 --- a/third_party/libcxx/include/c++/v1/__charconv/traits.h +++ /dev/null @@ -1,167 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___CHARCONV_TRAITS -#define _LIBCPP___CHARCONV_TRAITS - -#include <__assert> -#include <__bit/countl.h> -#include <__charconv/tables.h> -#include <__charconv/to_chars_base_10.h> -#include <__config> -#include <__memory/addressof.h> -#include <__type_traits/enable_if.h> -#include <__type_traits/is_unsigned.h> -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -namespace __itoa { - -template -struct _LIBCPP_HIDDEN __traits_base; - -template -struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t > { - using type = uint32_t; - - /// The width estimation using a log10 algorithm. - /// - /// The algorithm is based on - /// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10 - /// Instead of using IntegerLogBase2 it uses __countl_zero. - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { - auto __t = (32 - std::__countl_zero(static_cast(__v | 1))) * 1233 >> 12; - return __t - (__v < __itoa::__pow10_32[__t]) + 1; - } - - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) { - return __itoa::__base_10_u32(__p, __v); - } - - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI decltype(__pow10_32)& __pow() { - return __itoa::__pow10_32; - } -}; - -template -struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t > { - using type = uint64_t; - - /// The width estimation using a log10 algorithm. - /// - /// The algorithm is based on - /// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10 - /// Instead of using IntegerLogBase2 it uses __countl_zero. - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { - auto __t = (64 - std::__countl_zero(static_cast(__v | 1))) * 1233 >> 12; - return __t - (__v < __itoa::__pow10_64[__t]) + 1; - } - - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) { - return __itoa::__base_10_u64(__p, __v); - } - - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI decltype(__pow10_64)& __pow() { - return __itoa::__pow10_64; - } -}; - -# if _LIBCPP_HAS_INT128 -template -struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t > { - using type = __uint128_t; - - /// The width estimation using a log10 algorithm. - /// - /// The algorithm is based on - /// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10 - /// Instead of using IntegerLogBase2 it uses __countl_zero. - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { - _LIBCPP_ASSERT_INTERNAL( - __v > numeric_limits::max(), "The optimizations for this algorithm fail when this isn't true."); - // There's always a bit set in the upper 64-bits. - auto __t = (128 - std::__countl_zero(static_cast(__v >> 64))) * 1233 >> 12; - _LIBCPP_ASSERT_INTERNAL(__t >= __itoa::__pow10_128_offset, "Index out of bounds"); - // __t is adjusted since the lookup table misses the lower entries. - return __t - (__v < __itoa::__pow10_128[__t - __itoa::__pow10_128_offset]) + 1; - } - - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) { - return __itoa::__base_10_u128(__p, __v); - } - - // TODO FMT This pow function should get an index. - // By moving this to its own header it can be reused by the pow function in to_chars_base_10. - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI decltype(__pow10_128)& __pow() { - return __itoa::__pow10_128; - } -}; -# endif - -template -_LIBCPP_HIDE_FROM_ABI bool _LIBCPP_CONSTEXPR_SINCE_CXX23 __mul_overflowed(_Tp __a, _Up __b, _Tp& __r) { - static_assert(is_unsigned<_Tp>::value); - return __builtin_mul_overflow(__a, static_cast<_Tp>(__b), std::addressof(__r)); -} - -template -struct _LIBCPP_HIDDEN __traits : __traits_base<_Tp> { - static _LIBCPP_CONSTEXPR const int digits = numeric_limits<_Tp>::digits10 + 1; - using __traits_base<_Tp>::__pow; - using typename __traits_base<_Tp>::type; - - // precondition: at least one non-zero character available - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char const* - __read(char const* __p, char const* __ep, type& __a, type& __b) { - type __cprod[digits]; - int __j = digits - 1; - int __i = digits; - do { - if (*__p < '0' || *__p > '9') - break; - __cprod[--__i] = *__p++ - '0'; - } while (__p != __ep && __i != 0); - - __a = __inner_product(__cprod + __i + 1, __cprod + __j, __pow() + 1, __cprod[__i]); - if (__itoa::__mul_overflowed(__cprod[__j], __pow()[__j - __i], __b)) - --__p; - return __p; - } - - template - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _Up - __inner_product(_It1 __first1, _It1 __last1, _It2 __first2, _Up __init) { - for (; __first1 < __last1; ++__first1, ++__first2) - __init = __init + *__first1 * *__first2; - return __init; - } -}; - -} // namespace __itoa - -template -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _Tp __complement(_Tp __x) { - static_assert(is_unsigned<_Tp>::value, "cast to unsigned first"); - return _Tp(~__x + 1); -} - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___CHARCONV_TRAITS -- cgit v1.2.3