From 8740cf393c6e761fea8879e0db8a886f6b5ff6f3 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: f1246eedcd7a0b327e7e4a70803eb5cd20b071ef --- 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++; } } }