Changeset View
Changeset View
Standalone View
Standalone View
libcxx/include/charconv
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | |||||
#include <__assert> // all public C++ headers provide the assertion handler | #include <__assert> // all public C++ headers provide the assertion handler | ||||
#include <__availability> | #include <__availability> | ||||
#include <__bits> | #include <__bits> | ||||
#include <__charconv/chars_format.h> | #include <__charconv/chars_format.h> | ||||
#include <__charconv/from_chars_result.h> | #include <__charconv/from_chars_result.h> | ||||
#include <__charconv/tables.h> | #include <__charconv/tables.h> | ||||
#include <__charconv/to_chars_base_10.h> | #include <__charconv/to_chars_base_10.h> | ||||
#include <__charconv/to_chars_result.h> | #include <__charconv/to_chars_result.h> | ||||
#include <__cmath/logarithm.h> | |||||
#include <__config> | #include <__config> | ||||
#include <__debug> | #include <__debug> | ||||
#include <__errc> | #include <__errc> | ||||
#include <__type_traits/make_32_64_or_128_bit.h> | #include <__type_traits/make_32_64_or_128_bit.h> | ||||
#include <__utility/unreachable.h> | #include <__utility/unreachable.h> | ||||
#include <cmath> // for log2f | |||||
#include <cstdint> | #include <cstdint> | ||||
#include <cstdlib> | #include <cstdlib> | ||||
#include <cstring> | #include <cstring> | ||||
#include <limits> | #include <limits> | ||||
#include <type_traits> | #include <type_traits> | ||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||||
# pragma GCC system_header | # pragma GCC system_header | ||||
▲ Show 20 Lines • Show All 610 Lines • ▼ Show 20 Lines | __from_chars_integral(const char* __first, const char* __last, _Tp& __value, | ||||
if (__base == 10) | if (__base == 10) | ||||
return __from_chars_atoi(__first, __last, __value); | return __from_chars_atoi(__first, __last, __value); | ||||
return __subject_seq_combinator( | return __subject_seq_combinator( | ||||
__first, __last, __value, | __first, __last, __value, | ||||
[](const char* __p, const char* __lastp, _Tp& __val, | [](const char* __p, const char* __lastp, _Tp& __val, | ||||
int __b) -> from_chars_result { | int __b) -> from_chars_result { | ||||
using __tl = numeric_limits<_Tp>; | using __tl = numeric_limits<_Tp>; | ||||
auto __digits = __tl::digits / log2f(float(__b)); | auto __digits = __tl::digits / std::log2(float(__b)); | ||||
_Tp __x = __in_pattern(*__p++, __b).__val, __y = 0; | _Tp __x = __in_pattern(*__p++, __b).__val, __y = 0; | ||||
for (int __i = 1; __p != __lastp; ++__i, ++__p) | for (int __i = 1; __p != __lastp; ++__i, ++__p) | ||||
{ | { | ||||
if (auto __c = __in_pattern(*__p, __b)) | if (auto __c = __in_pattern(*__p, __b)) | ||||
{ | { | ||||
if (__i < __digits - 1) | if (__i < __digits - 1) | ||||
__x = __x * __b + __c.__val; | __x = __x * __b + __c.__val; | ||||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
# endif // _LIBCPP_STD_VER > 14 | # endif // _LIBCPP_STD_VER > 14 | ||||
#endif // _LIBCPP_CXX03_LANG | #endif // _LIBCPP_CXX03_LANG | ||||
_LIBCPP_END_NAMESPACE_STD | _LIBCPP_END_NAMESPACE_STD | ||||
_LIBCPP_POP_MACROS | _LIBCPP_POP_MACROS | ||||
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | ||||
# include <cmath> | |||||
# include <iosfwd> | # include <iosfwd> | ||||
#endif | #endif | ||||
#endif // _LIBCPP_CHARCONV | #endif // _LIBCPP_CHARCONV |