30 #ifndef _GLIBCXX_CHARCONV_H
31 #define _GLIBCXX_CHARCONV_H 1
33 #pragma GCC system_header
35 #if __cplusplus >= 201103L
39 namespace std _GLIBCXX_VISIBILITY(default)
41 _GLIBCXX_BEGIN_NAMESPACE_VERSION
45 template<
typename _Tp>
46 _GLIBCXX14_CONSTEXPR
unsigned
47 __to_chars_len(_Tp __value,
int __base = 10) noexcept
49 static_assert(is_integral<_Tp>::value,
"implementation bug");
50 static_assert(is_unsigned<_Tp>::value,
"implementation bug");
54 const unsigned __b3 = __b2 *
__base;
55 const unsigned long __b4 = __b3 *
__base;
58 if (__value < (
unsigned)
__base)
return __n;
59 if (__value < __b2)
return __n + 1;
60 if (__value < __b3)
return __n + 2;
61 if (__value < __b4)
return __n + 3;
70 template<
typename _Tp>
72 __to_chars_10_impl(
char* __first,
unsigned __len, _Tp __val) noexcept
74 static_assert(is_integral<_Tp>::value,
"implementation bug");
75 static_assert(is_unsigned<_Tp>::value,
"implementation bug");
77 static constexpr
char __digits[201] =
78 "0001020304050607080910111213141516171819"
79 "2021222324252627282930313233343536373839"
80 "4041424344454647484950515253545556575859"
81 "6061626364656667686970717273747576777879"
82 "8081828384858687888990919293949596979899";
83 unsigned __pos = __len - 1;
86 auto const __num = (__val % 100) * 2;
88 __first[__pos] = __digits[__num + 1];
89 __first[__pos - 1] = __digits[__num];
94 auto const __num = __val * 2;
95 __first[1] = __digits[__num + 1];
96 __first[0] = __digits[__num];
99 __first[0] =
'0' + __val;
103 _GLIBCXX_END_NAMESPACE_VERSION
ISO C++ entities toplevel namespace is std.
constexpr _Iterator __base(_Iterator __it)