[libcxx-commits] [PATCH] D96221: [libc++] Implement base 10 itoa functions.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Feb 7 10:18:44 PST 2021


Mordante created this revision.
Mordante added reviewers: EricWF, ldionne, mclow.lists, miscco, curdeius.
Herald added a subscriber: mgorny.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

This implements a new set of functions to convert an integral to a
string. Unlike the already available functions these can be:

- used with all character types,
- used with 128 bit integrals.

This implements the version for base 10, specialized versions for
base 2, 8, and 16 will be added later.

These functions perform better for numbers with a smaller amount of
digits and worse for number with a larger number of digits. The goal is
to investigate these differences later and see whether the new code can
be faster in all cases. It is also the intention to move to one set of
functions in the future. Since the format code still is a moving target
it's preferable to have two implementations at the moment.

Note: The usage of this code in the format header will be in a separate
patch.

Depends on D96057 <https://reviews.llvm.org/D96057>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96221

Files:
  libcxx/benchmarks/FormatItoa.h
  libcxx/benchmarks/format_itoa_character_width.bench.cpp
  libcxx/benchmarks/format_itoa_to_chars_base_10.bench.cpp
  libcxx/benchmarks/format_itoa_to_string.bench.cpp
  libcxx/include/CMakeLists.txt
  libcxx/include/__format_itoa
  libcxx/include/module.modulemap
  libcxx/test/std/utilities/format/__itoa/__character_width_base_10.pass.cpp
  libcxx/test/std/utilities/format/__itoa/__to_basic_string.pass.cpp
  libcxx/test/std/utilities/format/__itoa/__to_chars_base_10.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96221.321994.patch
Type: text/x-patch
Size: 65812 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210207/561d2c6f/attachment-0001.bin>


More information about the libcxx-commits mailing list