From cc2c7268013acff491a82aadcb7c7e151f3264b4 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 11 Apr 2012 15:20:05 +1000 Subject: [PATCH] Repurpose rotate function as rotate_left --- bitwise.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bitwise.hpp b/bitwise.hpp index baf69885..52c362f1 100644 --- a/bitwise.hpp +++ b/bitwise.hpp @@ -35,12 +35,10 @@ const uint8_t BITMASK_8BITS = 0xFF; template -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