The functions to_chars and from_chars should offer 128-bit support. This
is the first step to implement 128-bit version of to_chars. Before
implementing 128-bit support the current code will be polished.
This moves the code from the dylib to the header in prepartion of
P2291 "Add Constexpr Modifiers to Functions to_chars and from_chars for
Integral Types in <charconv> Header"
Note some more cleanups will be done in follow-up commits
- Remove the _LIBCPP_AVAILABILITY_TO_CHARS from to_chars. With all code in the header the availablilty macro is no longer needed. This requires enabling the unit tests for additional platforms.
- The code in the dylib can switch to using the header implementation. This allows removing the code duplicated in the header and the dylib.
What we want is essentially inline constexpr char __digits_base_10[200], but we can't have that because we need to support C++11. IIRC, the canonical way to do this pre-C++17 was:
Then, you access it as __digits_base_10<>::__value. It's not as pretty, but it gets you the linkonce_odr semantics that you are after even before C++17.
Note from live review: We may want to apply the same kind of transformation to the other places where we have this pattern in <charconv>. Using static constexpr might lead to code bloat.