From 11c435aa7ddec333b373af2ee46bb3bc33323dcc Mon Sep 17 00:00:00 2001 From: Lynix Date: Fri, 6 May 2016 19:15:15 +0200 Subject: [PATCH] Core/Bitset: Fix value constructor Former-commit-id: 9ed58dc40a513d32fac946d8876ac702713e279a --- include/Nazara/Core/Bitset.hpp | 2 +- include/Nazara/Core/Bitset.inl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/Nazara/Core/Bitset.hpp b/include/Nazara/Core/Bitset.hpp index a371212ab..3b440278c 100644 --- a/include/Nazara/Core/Bitset.hpp +++ b/include/Nazara/Core/Bitset.hpp @@ -31,7 +31,7 @@ namespace Nz Bitset(const char* bits, unsigned int bitCount); Bitset(const Bitset& bitset) = default; explicit Bitset(const String& bits); - template explicit Bitset(T value); + template Bitset(T value); Bitset(Bitset&& bitset) noexcept = default; ~Bitset() noexcept = default; diff --git a/include/Nazara/Core/Bitset.inl b/include/Nazara/Core/Bitset.inl index d689ff18a..efea1d2db 100644 --- a/include/Nazara/Core/Bitset.inl +++ b/include/Nazara/Core/Bitset.inl @@ -120,14 +120,14 @@ namespace Nz { if (sizeof(T) <= sizeof(Block)) { - m_bitCount = CountBits(value); + m_bitCount = std::numeric_limits::digits; m_blocks.push_back(value); } 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::digits; bit <<= 1) + for (T bit = 1; bit < std::numeric_limits::max(); bit <<= 1) { if (value & bit) UnboundedSet(bitPos, true); @@ -838,7 +838,7 @@ namespace Nz Block block = m_blocks[i]; - // Compute the position of LSB in the block (and adjustement of the position) + // Compute the position of LSB in the block (and adjustment of the position) return IntegralLog2Pot(block & -block) + i*bitsPerBlock; }