d3d8: Use wined3d_bit_scan() instead of open-coding it.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2019-01-25 09:46:53 +01:00 committed by Alexandre Julliard
parent b51bc84338
commit 5c3d4f39e2
1 changed files with 3 additions and 6 deletions

View File

@ -2280,8 +2280,7 @@ static void d3d8_device_upload_sysmem_vertex_buffers(struct d3d8_device *device,
map = device->sysmem_vb; map = device->sysmem_vb;
while (map) while (map)
{ {
i = ffs(map) - 1; i = wined3d_bit_scan(&map);
map ^= 1u << i;
if (FAILED(hr = wined3d_device_get_stream_source(device->wined3d_device, i, &dst_buffer, &offset, &stride))) if (FAILED(hr = wined3d_device_get_stream_source(device->wined3d_device, i, &dst_buffer, &offset, &stride)))
ERR("Failed to get stream source.\n"); ERR("Failed to get stream source.\n");
@ -2618,8 +2617,7 @@ static HRESULT WINAPI d3d8_device_ProcessVertices(IDirect3DDevice8 *iface, UINT
map = device->sysmem_vb; map = device->sysmem_vb;
while (map) while (map)
{ {
i = ffs(map) - 1; i = wined3d_bit_scan(&map);
map ^= 1u << i;
if (FAILED(wined3d_device_get_stream_source(device->wined3d_device, if (FAILED(wined3d_device_get_stream_source(device->wined3d_device,
i, &wined3d_buffer, &offset, &stride))) i, &wined3d_buffer, &offset, &stride)))
@ -2636,8 +2634,7 @@ static HRESULT WINAPI d3d8_device_ProcessVertices(IDirect3DDevice8 *iface, UINT
map = device->sysmem_vb; map = device->sysmem_vb;
while (map) while (map)
{ {
i = ffs(map) - 1; i = wined3d_bit_scan(&map);
map ^= 1u << i;
if (FAILED(wined3d_device_get_stream_source(device->wined3d_device, if (FAILED(wined3d_device_get_stream_source(device->wined3d_device,
i, &wined3d_buffer, &offset, &stride))) i, &wined3d_buffer, &offset, &stride)))