ddraw: Use wined3d_bit_scan() in viewport_alloc_active_light_index().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Henri Verbeet 2019-06-28 14:54:21 +04:30 committed by Alexandre Julliard
parent e867d986d5
commit f30248f336
1 changed files with 3 additions and 8 deletions

View File

@ -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;