File indexing completed on 2025-01-18 09:52:31
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_STACKTRACE_DETAIL_TO_DEC_ARRAY_HPP
0008 #define BOOST_STACKTRACE_DETAIL_TO_DEC_ARRAY_HPP
0009
0010 #include <boost/config.hpp>
0011 #ifdef BOOST_HAS_PRAGMA_ONCE
0012 # pragma once
0013 #endif
0014
0015 #include <array>
0016 #include <cstddef> // std::size_t
0017
0018 namespace boost { namespace stacktrace { namespace detail {
0019
0020
0021 inline std::array<char, 40> to_dec_array(std::size_t value) noexcept {
0022 std::array<char, 40> ret;
0023 if (!value) {
0024 ret[0] = '0';
0025 ret[1] = '\0';
0026 return ret;
0027 }
0028
0029 std::size_t digits = 0;
0030 for (std::size_t value_copy = value; value_copy; value_copy /= 10) {
0031 ++ digits;
0032 }
0033
0034 for (std::size_t i = 1; i <= digits; ++i) {
0035 ret[digits - i] = static_cast<char>('0' + (value % 10));
0036 value /= 10;
0037 }
0038
0039 ret[digits] = '\0';
0040
0041 return ret;
0042 }
0043
0044
0045 }}}
0046
0047 #endif