Repurpose rotate function as rotate_left
This commit is contained in:
parent
a3d965b917
commit
cc2c726801
@ -35,12 +35,10 @@ const uint8_t BITMASK_8BITS = 0xFF;
|
||||
|
||||
|
||||
template <typename T>
|
||||
T rotate (const T &value, int magnitude) {
|
||||
check_hard (magnitude < sizeof (value) * 8 &&
|
||||
magnitude > -sizeof (value) * 8);
|
||||
T rotate_left (const T &value, size_t magnitude) {
|
||||
magnitude %= sizeof (T) * 8;
|
||||
return (value << magnitude) | (value >> sizeof (value) * 8 - magnitude);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user