From 8697e134aeac0318e6686d785113f0763cbc3c1c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 16 Sep 2022 16:27:19 -0400 Subject: Fix signed bitwise operator operands --- include/chilbert/detail/operations.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/chilbert/detail/operations.hpp') diff --git a/include/chilbert/detail/operations.hpp b/include/chilbert/detail/operations.hpp index 7e846b3..398944f 100644 --- a/include/chilbert/detail/operations.hpp +++ b/include/chilbert/detail/operations.hpp @@ -145,7 +145,7 @@ template std::enable_if_t::value> gray_code(T& value) { - value ^= (value >> 1); + value ^= (value >> 1U); } /// Calculates the inverse Gray Code of `value` in place @@ -158,7 +158,7 @@ std::enable_if_t::value> gray_code_inv(T& value) { constexpr T shift_end = sizeof(T) * CHAR_BIT; - for (T shift = 1; shift < shift_end; shift <<= 1) { + for (T shift = 1U; shift < shift_end; shift <<= 1U) { value ^= (value >> shift); } } -- cgit v1.2.1