From 8c03fccd64ee85d053f7884b4ecf63be42b3ca04 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 6 Apr 2016 13:41:32 +0200 Subject: [PATCH] Fixed the bsr Portable C function, the game start correctly now --- Sources/Engine/Graphics/DrawPort_RenderScene.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/Engine/Graphics/DrawPort_RenderScene.cpp b/Sources/Engine/Graphics/DrawPort_RenderScene.cpp index a972d43..70b0bc6 100644 --- a/Sources/Engine/Graphics/DrawPort_RenderScene.cpp +++ b/Sources/Engine/Graphics/DrawPort_RenderScene.cpp @@ -521,15 +521,15 @@ static void RSBinToGroups( ScenePolygon *pspoFirst) #else // emulate x86's bsr opcode...not fast. :/ - register INDEX val = _ctGroupsCount; - register INDEX bsr = 0; + register DWORD val = _ctGroupsCount; + register INDEX bsr = 31; if (val != 0) { - while (bsr < 32) + while (bsr > 0) { - if (val & (1 << bsr)) + if (val & (1l << bsr)) break; - bsr++; + bsr--; } }