Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef BOOST_HASH2_DETAIL_ROT_HPP_INCLUDED
0002 #define BOOST_HASH2_DETAIL_ROT_HPP_INCLUDED
0003 
0004 // Copyright 2017, 2018, 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/config.hpp>
0009 #include <cstdint>
0010 
0011 namespace boost
0012 {
0013 namespace hash2
0014 {
0015 namespace detail
0016 {
0017 
0018 // k must not be 0
0019 BOOST_FORCEINLINE constexpr std::uint32_t rotl( std::uint32_t v, int k ) noexcept
0020 {
0021     return ( v << k ) | ( v >> ( 32 - k ) );
0022 }
0023 
0024 // k must not be 0
0025 BOOST_FORCEINLINE constexpr std::uint64_t rotl( std::uint64_t v, int k ) noexcept
0026 {
0027     return ( v << k ) | ( v >> ( 64 - k ) );
0028 }
0029 
0030 // k must not be 0
0031 BOOST_FORCEINLINE constexpr std::uint32_t rotr( std::uint32_t v, int k ) noexcept
0032 {
0033     return ( v >> k ) | ( v << ( 32 - k ) );
0034 }
0035 
0036 // k must not be 0
0037 BOOST_FORCEINLINE constexpr std::uint64_t rotr( std::uint64_t v, int k ) noexcept
0038 {
0039     return ( v >> k ) | ( v << ( 64 - k ) );
0040 }
0041 
0042 } // namespace detail
0043 } // namespace hash2
0044 } // namespace boost
0045 
0046 #endif // #ifndef BOOST_HASH2_DETAIL_ROT_HPP_INCLUDED