File indexing completed on 2025-04-19 08:19:40
0001
0002
0003
0004
0005 #ifndef BOOST_CHARCONV_DETAIL_MEMCPY_HPP
0006 #define BOOST_CHARCONV_DETAIL_MEMCPY_HPP
0007
0008 #include <boost/charconv/detail/config.hpp>
0009 #include <cstring>
0010 #include <cstdint>
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #if defined(__GNUC__) && __GNUC__ >= 10
0021 # pragma GCC diagnostic push
0022 # pragma GCC diagnostic ignored "-Wstringop-overflow"
0023 # define BOOST_CHARCONV_STRINGOP_OVERFLOW_DISABLED
0024 #endif
0025
0026 namespace boost { namespace charconv { namespace detail {
0027
0028 #if !defined(BOOST_CHARCONV_NO_CONSTEXPR_DETECTION) && defined(BOOST_CXX14_CONSTEXPR)
0029
0030 #define BOOST_CHARCONV_CONSTEXPR constexpr
0031
0032 constexpr char* memcpy(char* dest, const char* src, std::size_t count)
0033 {
0034 if (BOOST_CHARCONV_IS_CONSTANT_EVALUATED(count))
0035 {
0036 for (std::size_t i = 0; i < count; ++i)
0037 {
0038 *(dest + i) = *(src + i);
0039 }
0040
0041 return dest;
0042 }
0043 else
0044 {
0045
0046
0047
0048 #if defined(__GNUC__) && __GNUC__ == 11
0049 for (std::size_t i = 0; i < count; ++i)
0050 {
0051 *(dest + i) = *(src + i);
0052 }
0053
0054 return dest;
0055 #else
0056 return static_cast<char*>(std::memcpy(dest, src, count));
0057 #endif
0058 }
0059 }
0060
0061 #else
0062
0063 #define BOOST_CHARCONV_CONSTEXPR inline
0064
0065 inline void* memcpy(void* dest, const void* src, std::size_t count)
0066 {
0067 return std::memcpy(dest, src, count);
0068 }
0069
0070 #endif
0071
0072 }}}
0073
0074 #ifdef BOOST_CHARCONV_STRINGOP_OVERFLOW_DISABLED
0075 # pragma GCC diagnostic pop
0076 #endif
0077
0078 #endif