forked from OSchip/llvm-project
9393060f90
While working on D70631, Microsoft's unit tests discovered an issue. Our `std::to_chars` implementation for bases != 10 uses the range `[first,last)` as temporary buffer. This violates the contract for to_chars: [charconv.to.chars]/1 http://eel.is/c++draft/charconv#to.chars-1 `to_chars_result to_chars(char* first, char* last, see below value, int base = 10);` "If the member ec of the return value is such that the value is equal to the value of a value-initialized errc, the conversion was successful and the member ptr is the one-past-the-end pointer of the characters written." Our implementation modifies the range `[member ptr, last)`, which causes Microsoft's test to fail. Their test verifies the buffer `[member ptr, last)` is unchanged. (The test is only done when the conversion is successful.) While looking at the code I noticed the performance for bases != 10 also is suboptimal. This is tracked in D97705. This patch fixes the issue and adds a benchmark. This benchmark will be used as baseline for D97705. Reviewed By: #libc, Quuxplusone, zoecarver Differential Revision: https://reviews.llvm.org/D100722 |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
CartesianBenchmarks.h | ||
ContainerBenchmarks.h | ||
GenerateInput.h | ||
Utilities.h | ||
VariantBenchmarks.h | ||
algorithms.bench.cpp | ||
algorithms.partition_point.bench.cpp | ||
allocation.bench.cpp | ||
deque.bench.cpp | ||
filesystem.bench.cpp | ||
function.bench.cpp | ||
lit.cfg.py | ||
lit.site.cfg.py.in | ||
map.bench.cpp | ||
ordered_set.bench.cpp | ||
string.bench.cpp | ||
stringstream.bench.cpp | ||
to_chars.bench.cpp | ||
unordered_set_operations.bench.cpp | ||
util_smartptr.bench.cpp | ||
variant_visit_1.bench.cpp | ||
variant_visit_2.bench.cpp | ||
variant_visit_3.bench.cpp | ||
vector_operations.bench.cpp |