pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
prc
core
basic
functions
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
6
#include <
prc/core/basic/limits.hpp
>
7
#include <
prc/core/basic/type_traits.hpp
>
8
9
namespace
pRC
10
{
11
template
<
class
TA,
class
TB, If<IsUn
signed
Integral<TA>> = 0,
12
If<IsUn
signed
Integral<TB>> = 0>
13
static
inline
constexpr
auto
bitRotateRight
(
TA
const
value,
TB
count
)
14
{
15
count
%=
NumericLimits<TA>::digits
();
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
limits.hpp
type_traits.hpp
pRC
Definition
cholesky.hpp:18
pRC::bitRotateRight
static constexpr auto bitRotateRight(TA const value, TB count)
Definition
bit_rotate_right.hpp:13
pRC::copy
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition
copy.hpp:13
pRC::NumericLimits
Definition
limits.hpp:13
Generated by
1.9.8