Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- 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;