From f30248f3361fa175a919e8009b8f1778dba40942 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 28 Jun 2019 14:54:21 +0430 Subject: [PATCH] ddraw: Use wined3d_bit_scan() in viewport_alloc_active_light_index(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/ddraw/viewport.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/dlls/ddraw/viewport.c b/dlls/ddraw/viewport.c index e94c4b8da0e..556783ab947 100644 --- a/dlls/ddraw/viewport.c +++ b/dlls/ddraw/viewport.c @@ -152,15 +152,10 @@ void viewport_alloc_active_light_index(struct d3d_light *light) } } } - map = vp->map_lights; - assert(vp->active_lights_count < DDRAW_MAX_ACTIVE_LIGHTS && map != ~0u); - i = 0; - while (map & 1) - { - map >>= 1; - ++i; - } + map = ~vp->map_lights; + assert(vp->active_lights_count < DDRAW_MAX_ACTIVE_LIGHTS && map); + i = wined3d_bit_scan(&map); light->active_light_index = i + 1; ++vp->active_lights_count; vp->map_lights |= 1u << i;