From 82a3a0def9cd31efe9b28ee9332cb2fcf1d27173 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Wed, 2 Mar 2022 23:50:07 -0800 Subject: [PATCH] Fix floorPowerOfTwo --- src/Math.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Math.cpp b/src/Math.cpp index 925293d..42f4ec5 100644 --- a/src/Math.cpp +++ b/src/Math.cpp @@ -190,12 +190,7 @@ CVector3f getBezierPoint(const CVector3f& a, const CVector3f& b, const CVector3f int floorPowerOfTwo(int x) { if (x == 0) return 0; - /* - * we want to ensure that we always get the previous power, - * but if we have values like 256, we'll always get the same value, - * x-1 ensures that we always get the previous power. - */ - x = (x - 1) | (x >> 1); + x = x | (x >> 1); x = x | (x >> 2); x = x | (x >> 4); x = x | (x >> 8);