Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:33:42

0001 #ifndef BOOST_HASH2_DETAIL_MEMCPY_HPP_INCLUDED
0002 #define BOOST_HASH2_DETAIL_MEMCPY_HPP_INCLUDED
0003 
0004 // Copyright 2024 Peter Dimov
0005 // Distributed under the Boost Software License, Version 1.0.
0006 // https://www.boost.org/LICENSE_1_0.txt
0007 
0008 #include <boost/hash2/detail/is_constant_evaluated.hpp>
0009 #include <boost/config.hpp>
0010 #include <cstring>
0011 
0012 namespace boost
0013 {
0014 namespace hash2
0015 {
0016 namespace detail
0017 {
0018 
0019 #if defined(BOOST_NO_CXX14_CONSTEXPR)
0020 
0021 BOOST_FORCEINLINE void memcpy( unsigned char* d, unsigned char const* s, std::size_t n ) noexcept
0022 {
0023     std::memcpy( d, s, n );
0024 }
0025 
0026 #else
0027 
0028 constexpr void memcpy( unsigned char* d, unsigned char const* s, std::size_t n ) noexcept
0029 {
0030     if( !detail::is_constant_evaluated() )
0031     {
0032         std::memcpy( d, s, n );
0033     }
0034     else
0035     {
0036         for( std::size_t i = 0; i < n; ++i )
0037         {
0038             d[ i ] = s[ i ];
0039         }
0040     }
0041 }
0042 
0043 #endif
0044 
0045 } // namespace detail
0046 } // namespace hash2
0047 } // namespace boost
0048 
0049 #endif // #ifndef BOOST_HASH2_DETAIL_MEMCPY_HPP_INCLUDED