xref: /freebsd/contrib/llvm-project/libcxx/src/include/ryu/digit_table.h (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
10eae32dcSDimitry Andric //===----------------------------------------------------------------------===//
20eae32dcSDimitry Andric //
30eae32dcSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40eae32dcSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50eae32dcSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60eae32dcSDimitry Andric //
70eae32dcSDimitry Andric //===----------------------------------------------------------------------===//
80eae32dcSDimitry Andric 
90eae32dcSDimitry Andric // Copyright (c) Microsoft Corporation.
100eae32dcSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
110eae32dcSDimitry Andric 
120eae32dcSDimitry Andric // Copyright 2018 Ulf Adams
130eae32dcSDimitry Andric // Copyright (c) Microsoft Corporation. All rights reserved.
140eae32dcSDimitry Andric 
150eae32dcSDimitry Andric // Boost Software License - Version 1.0 - August 17th, 2003
160eae32dcSDimitry Andric 
170eae32dcSDimitry Andric // Permission is hereby granted, free of charge, to any person or organization
180eae32dcSDimitry Andric // obtaining a copy of the software and accompanying documentation covered by
190eae32dcSDimitry Andric // this license (the "Software") to use, reproduce, display, distribute,
200eae32dcSDimitry Andric // execute, and transmit the Software, and to prepare derivative works of the
210eae32dcSDimitry Andric // Software, and to permit third-parties to whom the Software is furnished to
220eae32dcSDimitry Andric // do so, all subject to the following:
230eae32dcSDimitry Andric 
240eae32dcSDimitry Andric // The copyright notices in the Software and this entire statement, including
250eae32dcSDimitry Andric // the above license grant, this restriction and the following disclaimer,
260eae32dcSDimitry Andric // must be included in all copies of the Software, in whole or in part, and
270eae32dcSDimitry Andric // all derivative works of the Software, unless such copies or derivative
280eae32dcSDimitry Andric // works are solely in the form of machine-executable object code generated by
290eae32dcSDimitry Andric // a source language processor.
300eae32dcSDimitry Andric 
310eae32dcSDimitry Andric // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
320eae32dcSDimitry Andric // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
330eae32dcSDimitry Andric // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
340eae32dcSDimitry Andric // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
350eae32dcSDimitry Andric // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
360eae32dcSDimitry Andric // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
370eae32dcSDimitry Andric // DEALINGS IN THE SOFTWARE.
380eae32dcSDimitry Andric 
390eae32dcSDimitry Andric #ifndef _LIBCPP_SRC_INCLUDE_RYU_DIGIT_TABLE_H
400eae32dcSDimitry Andric #define _LIBCPP_SRC_INCLUDE_RYU_DIGIT_TABLE_H
410eae32dcSDimitry Andric 
4281ad6265SDimitry Andric #include <__charconv/tables.h>
4381ad6265SDimitry Andric #include <__config>
440eae32dcSDimitry Andric 
450eae32dcSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD
460eae32dcSDimitry Andric 
470eae32dcSDimitry Andric // A table of all two-digit numbers. This is used to speed up decimal digit
480eae32dcSDimitry Andric // generation by copying pairs of digits into the final output.
4981ad6265SDimitry Andric //
5081ad6265SDimitry Andric // In order to minimize the diff in the Ryu code between MSVC STL and libc++
5181ad6265SDimitry Andric // the code uses the name __DIGIT_TABLE. In order to avoid code duplication it
5281ad6265SDimitry Andric // reuses the table already available in libc++.
53*bdd1243dSDimitry Andric inline constexpr auto& __DIGIT_TABLE = __itoa::__digits_base_10;
540eae32dcSDimitry Andric 
550eae32dcSDimitry Andric _LIBCPP_END_NAMESPACE_STD
560eae32dcSDimitry Andric 
570eae32dcSDimitry Andric #endif // _LIBCPP_SRC_INCLUDE_RYU_DIGIT_TABLE_H
58