From: Henri Verbeet Subject: [PATCH 07/10] wined3d: Use wined3d_bit_scan() in vshader_get_input(). Message-Id: <20220126144344.1402033-7-hverbeet@codeweavers.com> Date: Wed, 26 Jan 2022 15:43:41 +0100 Signed-off-by: Henri Verbeet --- dlls/wined3d/shader.c | 16 ++++++++-------- dlls/wined3d/wined3d_private.h | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 43c6bb402c0..2731639d554 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -3578,24 +3578,24 @@ static BOOL match_usage(BYTE usage1, BYTE usage_idx1, BYTE usage2, BYTE usage_id return FALSE; } -BOOL vshader_get_input(const struct wined3d_shader *shader, - BYTE usage_req, BYTE usage_idx_req, unsigned int *regnum) +bool vshader_get_input(const struct wined3d_shader *shader, + uint8_t usage_req, uint8_t usage_idx_req, unsigned int *regnum) { - WORD map = shader->reg_maps.input_registers; + uint32_t map = shader->reg_maps.input_registers & 0xffff; unsigned int i; - for (i = 0; map; map >>= 1, ++i) + while (map) { - if (!(map & 1)) continue; - + i = wined3d_bit_scan(&map); if (match_usage(shader->u.vs.attributes[i].usage, shader->u.vs.attributes[i].usage_idx, usage_req, usage_idx_req)) { *regnum = i; - return TRUE; + return true; } } - return FALSE; + + return false; } static HRESULT shader_init(struct wined3d_shader *shader, struct wined3d_device *device, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 8e45b61c61e..e28fc3b880d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -5759,8 +5759,8 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 BOOL position_transformed, struct ps_compile_args *args, const struct wined3d_context *context) DECLSPEC_HIDDEN; -BOOL vshader_get_input(const struct wined3d_shader *shader, - BYTE usage_req, BYTE usage_idx_req, unsigned int *regnum) DECLSPEC_HIDDEN; +bool vshader_get_input(const struct wined3d_shader *shader, + uint8_t usage_req, uint8_t usage_idx_req, unsigned int *regnum) DECLSPEC_HIDDEN; void find_vs_compile_args(const struct wined3d_state *state, const struct wined3d_shader *shader, struct vs_compile_args *args, const struct wined3d_context *context) DECLSPEC_HIDDEN; -- 2.30.2