From 014401899280a15b8b05312a4f91e379b875b634 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Fri, 26 Apr 2019 10:27:22 +1000 Subject: [PATCH] bitwise: don't allow full rotation --- bitwise.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bitwise.hpp b/bitwise.hpp index 92ff5565..11cff0e7 100644 --- a/bitwise.hpp +++ b/bitwise.hpp @@ -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)); }