From 0e48f052e5841ef9b832de7a8f0204ceee1eb93b Mon Sep 17 00:00:00 2001 From: Lynix Date: Sat, 24 Jan 2015 14:34:36 +0100 Subject: [PATCH] Fixed GetNearestPowerOfTwo function Returning the next POT even if the number was a POT itself Former-commit-id: 812f35d13a99985ca5c12517cd84de22292e52c7 --- include/Nazara/Math/Algorithm.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/Nazara/Math/Algorithm.inl b/include/Nazara/Math/Algorithm.inl index 8a1a0b91e..dc95dbba8 100644 --- a/include/Nazara/Math/Algorithm.inl +++ b/include/Nazara/Math/Algorithm.inl @@ -61,7 +61,7 @@ inline unsigned int NzGetNearestPowerOfTwo(unsigned int number) ///TODO: Marquer comme constexpr en C++14 unsigned int x = 1; // Tant que x est plus petit que n, on décale ses bits vers la gauche, ce qui revient à multiplier par deux - while (x <= number) + while (x < number) x <<= 1; return x;