bitwise: don't allow full rotation
This commit is contained in:
parent
1ca47626aa
commit
0144018992
@ -24,7 +24,7 @@ namespace cruft {
|
||||
constexpr T
|
||||
rotatel [[gnu::pure]] (const T value, std::size_t magnitude)
|
||||
{
|
||||
CHECK_LE (magnitude, sizeof (value) * 8);
|
||||
CHECK_LT (magnitude, sizeof (value) * 8u);
|
||||
|
||||
return (value << magnitude) | (value >> (sizeof (value) * 8 - magnitude));
|
||||
}
|
||||
@ -38,7 +38,7 @@ namespace cruft {
|
||||
constexpr T
|
||||
rotater [[gnu::pure]] (const T value, std::size_t magnitude)
|
||||
{
|
||||
CHECK_LE (magnitude, sizeof (value) * 8);
|
||||
CHECK_LT (magnitude, sizeof (value) * 8);
|
||||
|
||||
return (value >> magnitude) | (value << (sizeof (value) * 8 - magnitude));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user