From 34bc2301a0df87ab21b2a2c9ed5efa121f208faf Mon Sep 17 00:00:00 2001 From: Lynix Date: Mon, 9 May 2016 18:10:46 +0200 Subject: [PATCH] Core/Bitset: Fix infinite loop Former-commit-id: 366ad4248a72e3e06637163b44a9a5cedbbaf195 --- include/Nazara/Core/Bitset.inl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/include/Nazara/Core/Bitset.inl b/include/Nazara/Core/Bitset.inl index efea1d2db..568d4a815 100644 --- a/include/Nazara/Core/Bitset.inl +++ b/include/Nazara/Core/Bitset.inl @@ -126,13 +126,10 @@ namespace Nz else { // Note: I was kinda tired when I wrote this, there's probably a much easier method than checking bits to write bits - unsigned int bitPos = 0; - for (T bit = 1; bit < std::numeric_limits::max(); bit <<= 1) + for (unsigned int bitPos = 0; bitPos < std::numeric_limits::digits; bitPos++) { - if (value & bit) + if (value & (T(1U) << bitPos)) UnboundedSet(bitPos, true); - - bitPos++; } } }