diff options
Diffstat (limited to 'src/lib/utils')
-rw-r--r-- | src/lib/utils/rotate.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/utils/rotate.h b/src/lib/utils/rotate.h index b936521e6..8361e4705 100644 --- a/src/lib/utils/rotate.h +++ b/src/lib/utils/rotate.h @@ -20,6 +20,7 @@ namespace Botan { */ template<typename T> inline T rotate_left(T input, size_t rot) { + rot %= 8 * sizeof(T); return (rot == 0) ? input : static_cast<T>((input << rot) | (input >> (8*sizeof(T)-rot)));; } @@ -31,6 +32,7 @@ template<typename T> inline T rotate_left(T input, size_t rot) */ template<typename T> inline T rotate_right(T input, size_t rot) { + rot %= 8 * sizeof(T); return (rot == 0) ? input : static_cast<T>((input >> rot) | (input << (8*sizeof(T)-rot))); } |