pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
bit_rotate_right.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_BASIC_FUNCTIONS_BIT_ROTATE_RIGHT_H
4#define pRC_CORE_BASIC_FUNCTIONS_BIT_ROTATE_RIGHT_H
5
8
9namespace pRC
10{
11 template<class TA, class TB, If<IsUnsignedIntegral<TA>> = 0,
12 If<IsUnsignedIntegral<TB>> = 0>
13 static inline constexpr auto bitRotateRight(TA const value, TB count)
14 {
16
17 if(count == 0)
18 {
19 return value;
20 }
21
22 return (value >> count) |
23 (value << (NumericLimits<TA>::digits() - count));
24 }
25}
26#endif // pRC_CORE_BASIC_FUNCTIONS_BIT_ROTATE_RIGHT_H
Definition cholesky.hpp:18
static constexpr auto bitRotateRight(TA const value, TB count)
Definition bit_rotate_right.hpp:13
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13
Definition limits.hpp:13