Commit 2773b27b authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Use unsigned mask constants in shifts.

parent 9f530b57
......@@ -805,7 +805,8 @@ static void shader_generate_arb_declarations(const struct wined3d_shader *shader
{
DWORD idx = i >> 5;
DWORD shift = i & 0x1f;
if(reg_maps->constf[idx] & (1 << shift)) highest_constf = i;
if (reg_maps->constf[idx] & (1u << shift))
highest_constf = i;
}
if(use_nv_clip(gl_info) && ctx->target_version >= NV2)
......@@ -890,11 +891,14 @@ static void shader_generate_arb_declarations(const struct wined3d_shader *shader
/* Need to PARAM the environment parameters (constants) so we can use relative addressing */
shader_addline(buffer, "PARAM C[%d] = { program.env[0..%d] };\n",
max_constantsF, max_constantsF - 1);
} else {
for(i = 0; i < max_constantsF; i++) {
}
else
{
for (i = 0; i < max_constantsF; ++i)
{
DWORD idx, mask;
idx = i >> 5;
mask = 1 << (i & 0x1f);
mask = 1u << (i & 0x1fu);
if (!shader_constant_is_local(shader, i) && (reg_maps->constf[idx] & mask))
{
shader_addline(buffer, "PARAM C%d = program.env[%d];\n",i, i);
......@@ -1087,7 +1091,7 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction
}
else
{
if (ctx->cur_vs_args->super.swizzle_map & (1 << reg->idx[0].offset))
if (ctx->cur_vs_args->super.swizzle_map & (1u << reg->idx[0].offset))
*is_color = TRUE;
sprintf(register_name, "vertex.attrib[%u]", reg->idx[0].offset);
}
......@@ -1426,14 +1430,14 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
device = shader->device;
gl_info = &device->adapter->gl_info;
if (pshader && priv->cur_ps_args->super.np2_fixup & (1 << sampler_idx)
if (pshader && priv->cur_ps_args->super.np2_fixup & (1u << sampler_idx)
&& gl_info->supported[ARB_TEXTURE_RECTANGLE])
tex_type = "RECT";
else
tex_type = "2D";
if (shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type))
{
if (priv->cur_np2fixup_info->super.active & (1 << sampler_idx))
if (priv->cur_np2fixup_info->super.active & (1u << sampler_idx))
{
if (flags) FIXME("Only ordinary sampling from NP2 textures is supported.\n");
else np2_fixup = TRUE;
......@@ -3220,7 +3224,7 @@ static void vshader_add_footer(struct shader_arb_ctx_priv *priv_ctx,
for (i = 0; i < gl_info->limits.clipplanes; ++i)
{
if (args->clip.boolclip.clipplane_mask & (1 << i))
if (args->clip.boolclip.clipplane_mask & (1u << i))
{
shader_addline(buffer, "DP4 TA.%c, TMP_OUT, state.clip[%u].plane;\n",
component[cur_clip++], i);
......@@ -3810,7 +3814,8 @@ static GLuint shader_arb_generate_pshader(const struct wined3d_shader *shader,
i, compiled->bumpenvmatconst[bump_const].const_num);
compiled->numbumpenvmatconsts = bump_const + 1;
if (!(reg_maps->luminanceparams & (1 << i))) continue;
if (!(reg_maps->luminanceparams & (1u << i)))
continue;
compiled->luminanceconst[bump_const].const_num = next_local++;
shader_addline(buffer, "PARAM luminance%d = program.local[%d];\n",
......@@ -3820,7 +3825,7 @@ static GLuint shader_arb_generate_pshader(const struct wined3d_shader *shader,
for(i = 0; i < MAX_CONST_I; i++)
{
compiled->int_consts[i] = WINED3D_CONST_NUM_UNUSED;
if (reg_maps->integer_constants & (1 << i) && priv_ctx.target_version >= NV2)
if (reg_maps->integer_constants & (1u << i) && priv_ctx.target_version >= NV2)
{
const DWORD *control_values = find_loop_control_values(shader, i);
......@@ -3876,13 +3881,18 @@ static GLuint shader_arb_generate_pshader(const struct wined3d_shader *shader,
fixup->offset = next_local;
fixup->super.active = 0;
for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i) {
if (!(map & (1 << i))) continue;
for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
{
if (!(map & (1u << i)))
continue;
if (fixup->offset + (cur_fixup_sampler >> 1) < max_lconsts) {
fixup->super.active |= (1 << i);
if (fixup->offset + (cur_fixup_sampler >> 1) < max_lconsts)
{
fixup->super.active |= (1u << i);
fixup->super.idx[i] = cur_fixup_sampler++;
} else {
}
else
{
FIXME("No free constant found to load NP2 fixup data into shader. "
"Sampling from this texture will probably look wrong.\n");
break;
......@@ -4263,7 +4273,7 @@ static GLuint shader_arb_generate_vshader(const struct wined3d_shader *shader,
for(i = 0; i < MAX_CONST_I; i++)
{
compiled->int_consts[i] = WINED3D_CONST_NUM_UNUSED;
if(reg_maps->integer_constants & (1 << i) && priv_ctx.target_version >= NV2)
if (reg_maps->integer_constants & (1u << i) && priv_ctx.target_version >= NV2)
{
const DWORD *control_values = find_loop_control_values(shader, i);
......@@ -4536,7 +4546,7 @@ static void find_arb_ps_compile_args(const struct wined3d_state *state,
for(i = 0; i < MAX_CONST_B; i++)
{
if (state->ps_consts_b[i])
args->bools |= ( 1 << i);
args->bools |= ( 1u << i);
}
/* Only enable the clip plane emulation KIL if at least one clipplane is enabled. The KIL instruction
......@@ -4558,9 +4568,9 @@ static void find_arb_ps_compile_args(const struct wined3d_state *state,
return;
}
for(i = 0; i < MAX_CONST_I; i++)
for (i = 0; i < MAX_CONST_I; ++i)
{
if(int_skip & (1 << i))
if (int_skip & (1u << i))
{
args->loop_ctrl[i][0] = 0;
args->loop_ctrl[i][1] = 0;
......@@ -4618,7 +4628,7 @@ static void find_arb_vs_compile_args(const struct wined3d_state *state,
for(i = 0; i < MAX_CONST_B; i++)
{
if (state->vs_consts_b[i])
args->clip.boolclip.bools |= ( 1 << i);
args->clip.boolclip.bools |= (1u << i);
}
args->vertex.samplers[0] = context->tex_unit_map[MAX_FRAGMENT_SAMPLERS + 0];
......@@ -4637,7 +4647,7 @@ static void find_arb_vs_compile_args(const struct wined3d_state *state,
for(i = 0; i < MAX_CONST_I; i++)
{
if(int_skip & (1 << i))
if (int_skip & (1u << i))
{
args->loop_ctrl[i][0] = 0;
args->loop_ctrl[i][1] = 0;
......@@ -4820,9 +4830,9 @@ static void shader_arb_disable(void *shader_priv, struct wined3d_context *contex
priv->last_vs_color_unclamp = FALSE;
}
context->shader_update_mask = (1 << WINED3D_SHADER_TYPE_PIXEL)
| (1 << WINED3D_SHADER_TYPE_VERTEX)
| (1 << WINED3D_SHADER_TYPE_GEOMETRY);
context->shader_update_mask = (1u << WINED3D_SHADER_TYPE_PIXEL)
| (1u << WINED3D_SHADER_TYPE_VERTEX)
| (1u << WINED3D_SHADER_TYPE_GEOMETRY);
}
/* Context activation is done by the caller. */
......@@ -5326,7 +5336,7 @@ static BOOL get_bool_const(const struct wined3d_shader_instruction *ins,
BOOL vshader = shader_is_vshader_version(reg_maps->shader_version.type);
const struct wined3d_shader_lconst *constant;
WORD bools = 0;
WORD flag = (1 << idx);
WORD flag = (1u << idx);
struct shader_arb_ctx_priv *priv = ins->ctx->backend_data;
if (reg_maps->local_bool_consts & flag)
......@@ -5358,7 +5368,7 @@ static void get_loop_control_const(const struct wined3d_shader_instruction *ins,
/* Integer constants can either be a local constant, or they can be stored in the shader
* type specific compile args. */
if (reg_maps->local_int_consts & (1 << idx))
if (reg_maps->local_int_consts & (1u << idx))
{
const struct wined3d_shader_lconst *constant;
......@@ -6611,7 +6621,7 @@ static void fragment_prog_arbfp(struct wined3d_context *context, const struct wi
}
else if (use_pshader)
{
context->shader_update_mask |= 1 << WINED3D_SHADER_TYPE_PIXEL;
context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL;
}
return;
}
......@@ -6665,7 +6675,7 @@ static void fragment_prog_arbfp(struct wined3d_context *context, const struct wi
context->last_was_pshader = TRUE;
}
context->shader_update_mask |= 1 << WINED3D_SHADER_TYPE_PIXEL;
context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL;
}
/* We can't link the fog states to the fragment state directly since the
......
......@@ -275,7 +275,7 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct win
/* Ignore attributes that do not have our vbo. After that check we can be sure that the attribute is
* there, on nonexistent attribs the vbo is 0.
*/
if (!(si->use_map & (1 << attrib_idx))
if (!(si->use_map & (1u << attrib_idx))
|| state->streams[attrib->stream_idx].buffer != This)
return FALSE;
......@@ -432,9 +432,9 @@ static inline void fixup_d3dcolor(DWORD *dst_color)
* 0x000000ff: Red mask
*/
*dst_color = 0;
*dst_color |= (src_color & 0xff00ff00); /* Alpha Green */
*dst_color |= (src_color & 0x00ff0000) >> 16; /* Red */
*dst_color |= (src_color & 0x000000ff) << 16; /* Blue */
*dst_color |= (src_color & 0xff00ff00u); /* Alpha Green */
*dst_color |= (src_color & 0x00ff0000u) >> 16; /* Red */
*dst_color |= (src_color & 0x000000ffu) << 16; /* Blue */
}
static inline void fixup_transformed_pos(float *p)
......
......@@ -305,12 +305,12 @@ void context_check_fbo_status(const struct wined3d_context *context, GLenum targ
static inline DWORD context_generate_rt_mask(GLenum buffer)
{
/* Should take care of all the GL_FRONT/GL_BACK/GL_AUXi/GL_NONE... cases */
return buffer ? (1 << 31) | buffer : 0;
return buffer ? (1u << 31) | buffer : 0;
}
static inline DWORD context_generate_rt_mask_from_surface(const struct wined3d_surface *target)
{
return (1 << 31) | surface_get_gl_buffer(target);
return (1u << 31) | surface_get_gl_buffer(target);
}
static struct fbo_entry *context_create_fbo_entry(const struct wined3d_context *context,
......@@ -1228,7 +1228,7 @@ void context_invalidate_state(struct wined3d_context *context, DWORD state)
context->dirtyArray[context->numDirtyEntries++] = rep;
idx = rep / (sizeof(*context->isStateDirty) * CHAR_BIT);
shift = rep & ((sizeof(*context->isStateDirty) * CHAR_BIT) - 1);
context->isStateDirty[idx] |= (1 << shift);
context->isStateDirty[idx] |= (1u << shift);
}
/* This function takes care of wined3d pixel format selection. */
......@@ -1805,9 +1805,9 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
GL_EXTCALL(glProvokingVertexEXT(GL_FIRST_VERTEX_CONVENTION_EXT));
}
device->shader_backend->shader_init_context_state(ret);
ret->shader_update_mask = (1 << WINED3D_SHADER_TYPE_PIXEL)
| (1 << WINED3D_SHADER_TYPE_VERTEX)
| (1 << WINED3D_SHADER_TYPE_GEOMETRY);
ret->shader_update_mask = (1u << WINED3D_SHADER_TYPE_PIXEL)
| (1u << WINED3D_SHADER_TYPE_VERTEX)
| (1u << WINED3D_SHADER_TYPE_GEOMETRY);
/* If this happens to be the first context for the device, dummy textures
* are not created yet. In that case, they will be created (and bound) by
......@@ -2099,12 +2099,12 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
static inline BOOL is_rt_mask_onscreen(DWORD rt_mask)
{
return rt_mask & (1 << 31);
return rt_mask & (1u << 31);
}
static inline GLenum draw_buffer_from_rt_mask(DWORD rt_mask)
{
return rt_mask & ~(1 << 31);
return rt_mask & ~(1u << 31);
}
/* Context activation is done by the caller. */
......@@ -2387,7 +2387,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
{
context->blit_targets[i] = wined3d_rendertarget_view_get_surface(rts[i]);
if (rts[i] && rts[i]->format->id != WINED3DFMT_NULL)
rt_mask |= (1 << i);
rt_mask |= (1u << i);
}
while (i < context->gl_info->limits.buffers)
{
......@@ -2423,7 +2423,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
for (i = 0; i < rt_count; ++i)
{
if (rts[i] && rts[i]->format->id != WINED3DFMT_NULL)
rt_mask |= (1 << i);
rt_mask |= (1u << i);
}
}
else
......@@ -2482,9 +2482,9 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const
i = 0;
while (rt_mask_bits)
{
rt_mask_bits &= ~(1 << i);
rt_mask_bits &= ~(1u << i);
if (!rts[i] || rts[i]->format->id == WINED3DFMT_NULL)
rt_mask &= ~(1 << i);
rt_mask &= ~(1u << i);
i++;
}
......@@ -2581,11 +2581,11 @@ static void context_update_fixed_function_usage_map(struct wined3d_context *cont
|| ((alpha_arg2 == WINED3DTA_TEXTURE) && alpha_op != WINED3D_TOP_SELECT_ARG1)
|| ((alpha_arg3 == WINED3DTA_TEXTURE)
&& (alpha_op == WINED3D_TOP_MULTIPLY_ADD || alpha_op == WINED3D_TOP_LERP)))
context->fixed_function_usage_map |= (1 << i);
context->fixed_function_usage_map |= (1u << i);
if ((color_op == WINED3D_TOP_BUMPENVMAP || color_op == WINED3D_TOP_BUMPENVMAP_LUMINANCE)
&& i < MAX_TEXTURES - 1)
context->fixed_function_usage_map |= (1 << (i + 1));
context->fixed_function_usage_map |= (1u << (i + 1));
}
if (i < context->lowest_disabled_stage)
......@@ -2688,7 +2688,7 @@ static BOOL context_unit_free_for_vs(const struct wined3d_context *context,
if (!ps_resource_info)
{
/* No pixel shader, check fixed function */
return current_mapping >= MAX_TEXTURES || !(context->fixed_function_usage_map & (1 << current_mapping));
return current_mapping >= MAX_TEXTURES || !(context->fixed_function_usage_map & (1u << current_mapping));
}
/* Pixel shader, check the shader's sampler map */
......@@ -2903,9 +2903,9 @@ void context_stream_info_from_declaration(struct wined3d_context *context,
if (!context->gl_info->supported[ARB_VERTEX_ARRAY_BGRA]
&& element->format->id == WINED3DFMT_B8G8R8A8_UNORM)
{
stream_info->swizzle_map |= 1 << idx;
stream_info->swizzle_map |= 1u << idx;
}
stream_info->use_map |= 1 << idx;
stream_info->use_map |= 1u << idx;
}
}
}
......@@ -2983,9 +2983,9 @@ static void context_update_stream_info(struct wined3d_context *context, const st
}
else
{
WORD slow_mask = -!d3d_info->ffp_generic_attributes & (1 << WINED3D_FFP_PSIZE);
WORD slow_mask = -!d3d_info->ffp_generic_attributes & (1u << WINED3D_FFP_PSIZE);
slow_mask |= -!gl_info->supported[ARB_VERTEX_ARRAY_BGRA]
& ((1 << WINED3D_FFP_DIFFUSE) | (1 << WINED3D_FFP_SPECULAR));
& ((1u << WINED3D_FFP_DIFFUSE) | (1u << WINED3D_FFP_SPECULAR));
if (((stream_info->position_transformed && !d3d_info->xyzrhw)
|| (stream_info->use_map & slow_mask)) && !stream_info->all_vbo)
......@@ -3201,7 +3201,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de
DWORD rep = context->dirtyArray[i];
DWORD idx = rep / (sizeof(*context->isStateDirty) * CHAR_BIT);
BYTE shift = rep & ((sizeof(*context->isStateDirty) * CHAR_BIT) - 1);
context->isStateDirty[idx] &= ~(1 << shift);
context->isStateDirty[idx] &= ~(1u << shift);
state_table[rep].apply(context, state, rep);
}
......
......@@ -1257,7 +1257,7 @@ HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UI
prev_buffer = stream->buffer;
if (device->recording)
device->recording->changed.streamSource |= 1 << stream_idx;
device->recording->changed.streamSource |= 1u << stream_idx;
if (prev_buffer == buffer
&& stream->stride == stride
......@@ -1338,7 +1338,7 @@ HRESULT CDECL wined3d_device_set_stream_source_freq(struct wined3d_device *devic
stream->frequency = divider & 0x7fffff;
if (device->recording)
device->recording->changed.streamFreq |= 1 << stream_idx;
device->recording->changed.streamFreq |= 1u << stream_idx;
else if (stream->frequency != old_freq || stream->flags != old_flags)
wined3d_cs_emit_set_stream_source_freq(device->cs, stream_idx, stream->frequency, stream->flags);
......@@ -1374,7 +1374,7 @@ void CDECL wined3d_device_set_transform(struct wined3d_device *device,
if (device->recording)
{
TRACE("Recording... not performing anything.\n");
device->recording->changed.transform[d3dts >> 5] |= 1 << (d3dts & 0x1f);
device->recording->changed.transform[d3dts >> 5] |= 1u << (d3dts & 0x1f);
device->update_state->transforms[d3dts] = *matrix;
return;
}
......@@ -1763,7 +1763,7 @@ HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device,
}
if (device->recording)
device->recording->changed.clipplane |= 1 << plane_idx;
device->recording->changed.clipplane |= 1u << plane_idx;
if (!memcmp(&device->update_state->clip_planes[plane_idx], plane, sizeof(*plane)))
{
......@@ -1957,7 +1957,7 @@ void CDECL wined3d_device_set_render_state(struct wined3d_device *device,
if (device->recording)
{
TRACE("Recording... not performing anything.\n");
device->recording->changed.renderState[state >> 5] |= 1 << (state & 0x1f);
device->recording->changed.renderState[state >> 5] |= 1u << (state & 0x1f);
return;
}
......@@ -2005,7 +2005,7 @@ void CDECL wined3d_device_set_sampler_state(struct wined3d_device *device,
if (device->recording)
{
TRACE("Recording... not performing anything.\n");
device->recording->changed.samplerState[sampler_idx] |= 1 << state;
device->recording->changed.samplerState[sampler_idx] |= 1u << state;
return;
}
......@@ -2287,7 +2287,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device,
if (device->recording)
{
for (i = start_register; i < count + start_register; ++i)
device->recording->changed.vertexShaderConstantsB |= (1 << i);
device->recording->changed.vertexShaderConstantsB |= (1u << i);
}
else
{
......@@ -2334,7 +2334,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device,
if (device->recording)
{
for (i = start_register; i < count + start_register; ++i)
device->recording->changed.vertexShaderConstantsI |= (1 << i);
device->recording->changed.vertexShaderConstantsI |= (1u << i);
}
else
{
......@@ -2521,7 +2521,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device,
if (device->recording)
{
for (i = start_register; i < count + start_register; ++i)
device->recording->changed.pixelShaderConstantsB |= (1 << i);
device->recording->changed.pixelShaderConstantsB |= (1u << i);
}
else
{
......@@ -2568,7 +2568,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device,
if (device->recording)
{
for (i = start_register; i < count + start_register; ++i)
device->recording->changed.pixelShaderConstantsI |= (1 << i);
device->recording->changed.pixelShaderConstantsI |= (1u << i);
}
else
{
......@@ -2746,12 +2746,12 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO
DWORD numTextures;
HRESULT hr;
if (stream_info->use_map & (1 << WINED3D_FFP_NORMAL))
if (stream_info->use_map & (1u << WINED3D_FFP_NORMAL))
{
WARN(" lighting state not saved yet... Some strange stuff may happen !\n");
}
if (!(stream_info->use_map & (1 << WINED3D_FFP_POSITION)))
if (!(stream_info->use_map & (1u << WINED3D_FFP_POSITION)))
{
ERR("Source has no position mask\n");
return WINED3DERR_INVALIDCALL;
......@@ -2935,7 +2935,7 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO
{
const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_DIFFUSE];
const DWORD *color_d = (const DWORD *)(element->data.addr + i * element->stride);
if (!(stream_info->use_map & (1 << WINED3D_FFP_DIFFUSE)))
if (!(stream_info->use_map & (1u << WINED3D_FFP_DIFFUSE)))
{
static BOOL warned = FALSE;
......@@ -2958,7 +2958,7 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO
/* What's the color value in the feedback buffer? */
const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_SPECULAR];
const DWORD *color_s = (const DWORD *)(element->data.addr + i * element->stride);
if (!(stream_info->use_map & (1 << WINED3D_FFP_SPECULAR)))
if (!(stream_info->use_map & (1u << WINED3D_FFP_SPECULAR)))
{
static BOOL warned = FALSE;
......@@ -2980,7 +2980,7 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO
{
const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_TEXCOORD0 + tex_index];
const float *tex_coord = (const float *)(element->data.addr + i * element->stride);
if (!(stream_info->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + tex_index))))
if (!(stream_info->use_map & (1u << (WINED3D_FFP_TEXCOORD0 + tex_index))))
{
ERR("No source texture, but destination requests one\n");
dest_ptr += GET_TEXCOORD_SIZE_FROM_FVF(DestFVF, tex_index) * sizeof(float);
......@@ -3090,7 +3090,7 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device,
if (device->recording)
{
TRACE("Recording... not performing anything.\n");
device->recording->changed.textureState[stage] |= 1 << state;
device->recording->changed.textureState[stage] |= 1u << state;
return;
}
......@@ -3143,7 +3143,7 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device,
}
if (device->recording)
device->recording->changed.textures |= 1 << stage;
device->recording->changed.textures |= 1u << stage;
prev = device->update_state->textures[stage];
TRACE("Previous texture %p.\n", prev);
......@@ -5095,7 +5095,7 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state)
context->dirtyArray[context->numDirtyEntries++] = rep;
idx = rep / (sizeof(*context->isStateDirty) * CHAR_BIT);
shift = rep & ((sizeof(*context->isStateDirty) * CHAR_BIT) - 1);
context->isStateDirty[idx] |= (1 << shift);
context->isStateDirty[idx] |= (1u << shift);
}
}
......
......@@ -3799,7 +3799,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
adapter->d3d_info.valid_rt_mask = 0;
for (i = 0; i < gl_info->limits.buffers; ++i)
adapter->d3d_info.valid_rt_mask |= (1 << i);
adapter->d3d_info.valid_rt_mask |= (1u << i);
if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
{
......
......@@ -139,13 +139,13 @@ static void drawStridedSlow(const struct wined3d_device *device, struct wined3d_
/* Start drawing in GL */
gl_info->gl_ops.gl.p_glBegin(glPrimType);
if (si->use_map & (1 << WINED3D_FFP_POSITION))
if (si->use_map & (1u << WINED3D_FFP_POSITION))
{
element = &si->elements[WINED3D_FFP_POSITION];
position = element->data.addr;
}
if (si->use_map & (1 << WINED3D_FFP_NORMAL))
if (si->use_map & (1u << WINED3D_FFP_NORMAL))
{
element = &si->elements[WINED3D_FFP_NORMAL];
normal = element->data.addr;
......@@ -156,7 +156,7 @@ static void drawStridedSlow(const struct wined3d_device *device, struct wined3d_
}
num_untracked_materials = context->num_untracked_materials;
if (si->use_map & (1 << WINED3D_FFP_DIFFUSE))
if (si->use_map & (1u << WINED3D_FFP_DIFFUSE))
{
element = &si->elements[WINED3D_FFP_DIFFUSE];
diffuse = element->data.addr;
......@@ -169,7 +169,7 @@ static void drawStridedSlow(const struct wined3d_device *device, struct wined3d_
gl_info->gl_ops.gl.p_glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
if (si->use_map & (1 << WINED3D_FFP_SPECULAR))
if (si->use_map & (1u << WINED3D_FFP_SPECULAR))
{
element = &si->elements[WINED3D_FFP_SPECULAR];
specular = element->data.addr;
......@@ -229,11 +229,11 @@ static void drawStridedSlow(const struct wined3d_device *device, struct wined3d_
continue;
}
if (si->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx)))
if (si->use_map & (1u << (WINED3D_FFP_TEXCOORD0 + coordIdx)))
{
element = &si->elements[WINED3D_FFP_TEXCOORD0 + coordIdx];
texCoords[coordIdx] = element->data.addr;
tex_mask |= (1 << textureNo);
tex_mask |= (1u << textureNo);
}
else
{
......@@ -368,9 +368,9 @@ static inline void send_attribute(const struct wined3d_gl_info *gl_info,
if (gl_info->supported[ARB_VERTEX_ARRAY_BGRA])
{
const DWORD *src = ptr;
DWORD c = *src & 0xff00ff00;
c |= (*src & 0xff0000) >> 16;
c |= (*src & 0xff) << 16;
DWORD c = *src & 0xff00ff00u;
c |= (*src & 0xff0000u) >> 16;
c |= (*src & 0xffu) << 16;
GL_EXTCALL(glVertexAttrib4Nubv(index, (GLubyte *)&c));
break;
}
......@@ -497,7 +497,7 @@ static void drawStridedSlowVs(struct wined3d_context *context, const struct wine
for (i = MAX_ATTRIBS - 1; i >= 0; i--)
{
if (!(si->use_map & (1 << i))) continue;
if (!(si->use_map & (1u << i))) continue;
ptr = si->elements[i].data.addr + si->elements[i].stride * SkipnStrides;
......@@ -534,7 +534,7 @@ static void drawStridedInstanced(struct wined3d_context *context, const struct w
for (i = 0; i < sizeof(si->elements) / sizeof(*si->elements); ++i)
{
if (!(si->use_map & (1 << i))) continue;
if (!(si->use_map & (1u << i))) continue;
if (state->streams[si->elements[i].stream_idx].flags & WINED3DSTREAMSOURCE_INSTANCEDATA)
{
......@@ -582,7 +582,7 @@ static void remove_vbos(struct wined3d_context *context,
{
struct wined3d_stream_info_element *e;
if (!(s->use_map & (1 << i))) continue;
if (!(s->use_map & (1u << i))) continue;
e = &s->elements[i];
if (e->data.buffer_object)
......
......@@ -41,9 +41,11 @@ static void nvts_activate_dimensions(const struct wined3d_state *state, DWORD st
|| state->texture_states[stage - 1][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP))
{
bumpmap = TRUE;
context->texShaderBumpMap |= (1 << stage);
} else {
context->texShaderBumpMap &= ~(1 << stage);
context->texShaderBumpMap |= (1u << stage);
}
else
{
context->texShaderBumpMap &= ~(1u << stage);
}
if (state->textures[stage])
......@@ -477,7 +479,7 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
static void nvrc_colorop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
BOOL tex_used = context->fixed_function_usage_map & (1 << stage);
BOOL tex_used = context->fixed_function_usage_map & (1u << stage);
DWORD mapped_stage = context->tex_unit_map[stage];
const struct wined3d_gl_info *gl_info = context->gl_info;
......@@ -570,7 +572,7 @@ static void nvrc_colorop(struct wined3d_context *context, const struct wined3d_s
{
BOOL usesBump = (state->texture_states[stage][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP_LUMINANCE
|| state->texture_states[stage][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP);
BOOL usedBump = !!(context->texShaderBumpMap & 1 << (stage + 1));
BOOL usedBump = !!(context->texShaderBumpMap & 1u << (stage + 1));
if (usesBump != usedBump)
{
context_active_texture(context, gl_info, mapped_stage + 1);
......
......@@ -31,62 +31,62 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
/* DCL usage masks */
#define WINED3DSP_DCL_USAGE_SHIFT 0
#define WINED3DSP_DCL_USAGE_MASK (0xf << WINED3DSP_DCL_USAGE_SHIFT)
#define WINED3DSP_DCL_USAGE_MASK (0xfu << WINED3DSP_DCL_USAGE_SHIFT)
#define WINED3DSP_DCL_USAGEINDEX_SHIFT 16
#define WINED3DSP_DCL_USAGEINDEX_MASK (0xf << WINED3DSP_DCL_USAGEINDEX_SHIFT)
#define WINED3DSP_DCL_USAGEINDEX_MASK (0xfu << WINED3DSP_DCL_USAGEINDEX_SHIFT)
/* DCL sampler type */
#define WINED3D_SM1_RESOURCE_TYPE_SHIFT 27
#define WINED3D_SM1_RESOURCE_TYPE_MASK (0xf << WINED3D_SM1_RESOURCE_TYPE_SHIFT)
#define WINED3D_SM1_RESOURCE_TYPE_MASK (0xfu << WINED3D_SM1_RESOURCE_TYPE_SHIFT)
/* Opcode-related masks */
#define WINED3DSI_OPCODE_MASK 0x0000ffff
#define WINED3D_OPCODESPECIFICCONTROL_SHIFT 16
#define WINED3D_OPCODESPECIFICCONTROL_MASK (0xff << WINED3D_OPCODESPECIFICCONTROL_SHIFT)
#define WINED3D_OPCODESPECIFICCONTROL_MASK (0xffu << WINED3D_OPCODESPECIFICCONTROL_SHIFT)
#define WINED3DSI_INSTLENGTH_SHIFT 24
#define WINED3DSI_INSTLENGTH_MASK (0xf << WINED3DSI_INSTLENGTH_SHIFT)
#define WINED3DSI_INSTLENGTH_MASK (0xfu << WINED3DSI_INSTLENGTH_SHIFT)
#define WINED3DSI_COISSUE (1 << 30)
#define WINED3DSI_COISSUE (0x1u << 30)
#define WINED3DSI_COMMENTSIZE_SHIFT 16
#define WINED3DSI_COMMENTSIZE_MASK (0x7fff << WINED3DSI_COMMENTSIZE_SHIFT)
#define WINED3DSI_COMMENTSIZE_MASK (0x7fffu << WINED3DSI_COMMENTSIZE_SHIFT)
#define WINED3DSHADER_INSTRUCTION_PREDICATED (1 << 28)
#define WINED3DSHADER_INSTRUCTION_PREDICATED (0x1u << 28)
/* Register number mask */
#define WINED3DSP_REGNUM_MASK 0x000007ff
/* Register type masks */
#define WINED3DSP_REGTYPE_SHIFT 28
#define WINED3DSP_REGTYPE_MASK (0x7 << WINED3DSP_REGTYPE_SHIFT)
#define WINED3DSP_REGTYPE_MASK (0x7u << WINED3DSP_REGTYPE_SHIFT)
#define WINED3DSP_REGTYPE_SHIFT2 8
#define WINED3DSP_REGTYPE_MASK2 (0x18 << WINED3DSP_REGTYPE_SHIFT2)
#define WINED3DSP_REGTYPE_MASK2 (0x18u << WINED3DSP_REGTYPE_SHIFT2)
/* Relative addressing mask */
#define WINED3DSHADER_ADDRESSMODE_SHIFT 13
#define WINED3DSHADER_ADDRESSMODE_MASK (1 << WINED3DSHADER_ADDRESSMODE_SHIFT)
#define WINED3DSHADER_ADDRESSMODE_MASK (0x1u << WINED3DSHADER_ADDRESSMODE_SHIFT)
/* Destination modifier mask */
#define WINED3DSP_DSTMOD_SHIFT 20
#define WINED3DSP_DSTMOD_MASK (0xf << WINED3DSP_DSTMOD_SHIFT)
#define WINED3DSP_DSTMOD_MASK (0xfu << WINED3DSP_DSTMOD_SHIFT)
/* Destination shift mask */
#define WINED3DSP_DSTSHIFT_SHIFT 24
#define WINED3DSP_DSTSHIFT_MASK (0xf << WINED3DSP_DSTSHIFT_SHIFT)
#define WINED3DSP_DSTSHIFT_MASK (0xfu << WINED3DSP_DSTSHIFT_SHIFT)
/* Write mask */
#define WINED3D_SM1_WRITEMASK_SHIFT 16
#define WINED3D_SM1_WRITEMASK_MASK (0xf << WINED3D_SM1_WRITEMASK_SHIFT)
#define WINED3D_SM1_WRITEMASK_MASK (0xfu << WINED3D_SM1_WRITEMASK_SHIFT)
/* Swizzle mask */
#define WINED3DSP_SWIZZLE_SHIFT 16
#define WINED3DSP_SWIZZLE_MASK (0xff << WINED3DSP_SWIZZLE_SHIFT)
#define WINED3DSP_SWIZZLE_MASK (0xffu << WINED3DSP_SWIZZLE_SHIFT)
/* Source modifier mask */
#define WINED3DSP_SRCMOD_SHIFT 24
#define WINED3DSP_SRCMOD_MASK (0xf << WINED3DSP_SRCMOD_SHIFT)
#define WINED3DSP_SRCMOD_MASK (0xfu << WINED3DSP_SRCMOD_SHIFT)
#define WINED3DSP_END 0x0000ffff
......@@ -95,8 +95,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
enum WINED3DSHADER_ADDRESSMODE_TYPE
{
WINED3DSHADER_ADDRMODE_ABSOLUTE = 0 << WINED3DSHADER_ADDRESSMODE_SHIFT,
WINED3DSHADER_ADDRMODE_RELATIVE = 1 << WINED3DSHADER_ADDRESSMODE_SHIFT,
WINED3DSHADER_ADDRMODE_ABSOLUTE = 0u << WINED3DSHADER_ADDRESSMODE_SHIFT,
WINED3DSHADER_ADDRMODE_RELATIVE = 1u << WINED3DSHADER_ADDRESSMODE_SHIFT,
};
enum wined3d_sm1_resource_type
......@@ -412,7 +412,7 @@ static int shader_get_param(const struct wined3d_sm1_data *priv, const DWORD *pt
{
if (priv->shader_version.major < 2)
{
*addr_token = (1 << 31)
*addr_token = (1u << 31)
| ((WINED3DSPR_ADDR << WINED3DSP_REGTYPE_SHIFT2) & WINED3DSP_REGTYPE_MASK2)
| ((WINED3DSPR_ADDR << WINED3DSP_REGTYPE_SHIFT) & WINED3DSP_REGTYPE_MASK)
| (WINED3DSP_NOSWIZZLE << WINED3DSP_SWIZZLE_SHIFT);
......
......@@ -24,47 +24,47 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode);
#define WINED3D_SM4_INSTRUCTION_MODIFIER (1 << 31)
#define WINED3D_SM4_INSTRUCTION_MODIFIER (0x1u << 31)
#define WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT 24
#define WINED3D_SM4_INSTRUCTION_LENGTH_MASK (0x1f << WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT)
#define WINED3D_SM4_INSTRUCTION_LENGTH_MASK (0x1fu << WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT)
#define WINED3D_SM4_RESOURCE_TYPE_SHIFT 11
#define WINED3D_SM4_RESOURCE_TYPE_MASK (0xf << WINED3D_SM4_RESOURCE_TYPE_SHIFT)
#define WINED3D_SM4_RESOURCE_TYPE_MASK (0xfu << WINED3D_SM4_RESOURCE_TYPE_SHIFT)
#define WINED3D_SM4_PRIMITIVE_TYPE_SHIFT 11
#define WINED3D_SM4_PRIMITIVE_TYPE_MASK (0x7 << WINED3D_SM4_PRIMITIVE_TYPE_SHIFT)
#define WINED3D_SM4_PRIMITIVE_TYPE_MASK (0x7u << WINED3D_SM4_PRIMITIVE_TYPE_SHIFT)
#define WINED3D_SM4_INDEX_TYPE_SHIFT 11
#define WINED3D_SM4_INDEX_TYPE_MASK (0x1 << WINED3D_SM4_INDEX_TYPE_SHIFT)
#define WINED3D_SM4_INDEX_TYPE_MASK (0x1u << WINED3D_SM4_INDEX_TYPE_SHIFT)
#define WINED3D_SM4_OPCODE_MASK 0xff
#define WINED3D_SM4_REGISTER_MODIFIER (1 << 31)
#define WINED3D_SM4_REGISTER_MODIFIER (0x1u << 31)
#define WINED3D_SM4_ADDRESSING_SHIFT1 25
#define WINED3D_SM4_ADDRESSING_MASK1 (0x3 << WINED3D_SM4_ADDRESSING_SHIFT1)
#define WINED3D_SM4_ADDRESSING_MASK1 (0x3u << WINED3D_SM4_ADDRESSING_SHIFT1)
#define WINED3D_SM4_ADDRESSING_SHIFT0 22
#define WINED3D_SM4_ADDRESSING_MASK0 (0x3 << WINED3D_SM4_ADDRESSING_SHIFT0)
#define WINED3D_SM4_ADDRESSING_MASK0 (0x3u << WINED3D_SM4_ADDRESSING_SHIFT0)
#define WINED3D_SM4_REGISTER_ORDER_SHIFT 20
#define WINED3D_SM4_REGISTER_ORDER_MASK (0x3 << WINED3D_SM4_REGISTER_ORDER_SHIFT)
#define WINED3D_SM4_REGISTER_ORDER_MASK (0x3u << WINED3D_SM4_REGISTER_ORDER_SHIFT)
#define WINED3D_SM4_REGISTER_TYPE_SHIFT 12
#define WINED3D_SM4_REGISTER_TYPE_MASK (0xf << WINED3D_SM4_REGISTER_TYPE_SHIFT)
#define WINED3D_SM4_REGISTER_TYPE_MASK (0xfu << WINED3D_SM4_REGISTER_TYPE_SHIFT)
#define WINED3D_SM4_SWIZZLE_TYPE_SHIFT 2
#define WINED3D_SM4_SWIZZLE_TYPE_MASK (0x3 << WINED3D_SM4_SWIZZLE_TYPE_SHIFT)
#define WINED3D_SM4_SWIZZLE_TYPE_MASK (0x3u << WINED3D_SM4_SWIZZLE_TYPE_SHIFT)
#define WINED3D_SM4_IMMCONST_TYPE_SHIFT 0
#define WINED3D_SM4_IMMCONST_TYPE_MASK (0x3 << WINED3D_SM4_IMMCONST_TYPE_SHIFT)
#define WINED3D_SM4_IMMCONST_TYPE_MASK (0x3u << WINED3D_SM4_IMMCONST_TYPE_SHIFT)
#define WINED3D_SM4_WRITEMASK_SHIFT 4
#define WINED3D_SM4_WRITEMASK_MASK (0xf << WINED3D_SM4_WRITEMASK_SHIFT)
#define WINED3D_SM4_WRITEMASK_MASK (0xfu << WINED3D_SM4_WRITEMASK_SHIFT)
#define WINED3D_SM4_SWIZZLE_SHIFT 4
#define WINED3D_SM4_SWIZZLE_MASK (0xff << WINED3D_SM4_SWIZZLE_SHIFT)
#define WINED3D_SM4_SWIZZLE_MASK (0xffu << WINED3D_SM4_SWIZZLE_SHIFT)
#define WINED3D_SM4_VERSION_MAJOR(version) (((version) >> 4) & 0xf)
#define WINED3D_SM4_VERSION_MINOR(version) (((version) >> 0) & 0xf)
......
......@@ -225,7 +225,7 @@ fail:
static inline void stateblock_set_bits(DWORD *map, UINT map_size)
{
DWORD mask = (1 << (map_size & 0x1f)) - 1;
DWORD mask = (1u << (map_size & 0x1f)) - 1;
memset(map, 0xff, (map_size >> 5) * sizeof(*map));
if (mask) map[map_size >> 5] = mask;
}
......@@ -275,14 +275,14 @@ static void stateblock_savedstates_set_pixel(struct wined3d_saved_states *states
for (i = 0; i < sizeof(pixel_states_render) / sizeof(*pixel_states_render); ++i)
{
DWORD rs = pixel_states_render[i];
states->renderState[rs >> 5] |= 1 << (rs & 0x1f);
states->renderState[rs >> 5] |= 1u << (rs & 0x1f);
}
for (i = 0; i < sizeof(pixel_states_texture) / sizeof(*pixel_states_texture); ++i)
texture_mask |= 1 << pixel_states_texture[i];
texture_mask |= 1u << pixel_states_texture[i];
for (i = 0; i < MAX_TEXTURES; ++i) states->textureState[i] = texture_mask;
for (i = 0; i < sizeof(pixel_states_sampler) / sizeof(*pixel_states_sampler); ++i)
sampler_mask |= 1 << pixel_states_sampler[i];
sampler_mask |= 1u << pixel_states_sampler[i];
for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) states->samplerState[i] = sampler_mask;
states->pixelShaderConstantsB = 0xffff;
states->pixelShaderConstantsI = 0xffff;
......@@ -302,14 +302,14 @@ static void stateblock_savedstates_set_vertex(struct wined3d_saved_states *state
for (i = 0; i < sizeof(vertex_states_render) / sizeof(*vertex_states_render); ++i)
{
DWORD rs = vertex_states_render[i];
states->renderState[rs >> 5] |= 1 << (rs & 0x1f);
states->renderState[rs >> 5] |= 1u << (rs & 0x1f);
}
for (i = 0; i < sizeof(vertex_states_texture) / sizeof(*vertex_states_texture); ++i)
texture_mask |= 1 << vertex_states_texture[i];
texture_mask |= 1u << vertex_states_texture[i];
for (i = 0; i < MAX_TEXTURES; ++i) states->textureState[i] = texture_mask;
for (i = 0; i < sizeof(vertex_states_sampler) / sizeof(*vertex_states_sampler); ++i)
sampler_mask |= 1 << vertex_states_sampler[i];
sampler_mask |= 1u << vertex_states_sampler[i];
for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) states->samplerState[i] = sampler_mask;
states->vertexShaderConstantsB = 0xffff;
states->vertexShaderConstantsI = 0xffff;
......@@ -357,7 +357,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
for (i = 0; i < MAX_CONST_I; ++i)
{
if (stateblock->changed.vertexShaderConstantsI & (1 << i))
if (stateblock->changed.vertexShaderConstantsI & (1u << i))
{
stateblock->contained_vs_consts_i[stateblock->num_contained_vs_consts_i] = i;
++stateblock->num_contained_vs_consts_i;
......@@ -366,7 +366,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
for (i = 0; i < MAX_CONST_B; ++i)
{
if (stateblock->changed.vertexShaderConstantsB & (1 << i))
if (stateblock->changed.vertexShaderConstantsB & (1u << i))
{
stateblock->contained_vs_consts_b[stateblock->num_contained_vs_consts_b] = i;
++stateblock->num_contained_vs_consts_b;
......@@ -384,7 +384,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
for (i = 0; i < MAX_CONST_I; ++i)
{
if (stateblock->changed.pixelShaderConstantsI & (1 << i))
if (stateblock->changed.pixelShaderConstantsI & (1u << i))
{
stateblock->contained_ps_consts_i[stateblock->num_contained_ps_consts_i] = i;
++stateblock->num_contained_ps_consts_i;
......@@ -393,7 +393,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
for (i = 0; i < MAX_CONST_B; ++i)
{
if (stateblock->changed.pixelShaderConstantsB & (1 << i))
if (stateblock->changed.pixelShaderConstantsB & (1u << i))
{
stateblock->contained_ps_consts_b[stateblock->num_contained_ps_consts_b] = i;
++stateblock->num_contained_ps_consts_b;
......
......@@ -351,9 +351,9 @@ void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3
/* Works correctly only for <= 4 bpp formats. */
static void get_color_masks(const struct wined3d_format *format, DWORD *masks)
{
masks[0] = ((1 << format->red_size) - 1) << format->red_offset;
masks[1] = ((1 << format->green_size) - 1) << format->green_offset;
masks[2] = ((1 << format->blue_size) - 1) << format->blue_offset;
masks[0] = ((1u << format->red_size) - 1) << format->red_offset;
masks[1] = ((1u << format->green_size) - 1) << format->green_offset;
masks[2] = ((1u << format->blue_size) - 1) << format->blue_offset;
}
static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
......@@ -388,7 +388,7 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
default:
/* Allocate extra space for a palette. */
b_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * (1 << (format->byte_count * 8)));
sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * (1u << (format->byte_count * 8)));
break;
}
......@@ -2206,10 +2206,10 @@ static void convert_r5g6b5_x8r8g8b8(const BYTE *src, BYTE *dst,
for (x = 0; x < w; ++x)
{
WORD pixel = src_line[x];
dst_line[x] = 0xff000000
| convert_5to8[(pixel & 0xf800) >> 11] << 16
| convert_6to8[(pixel & 0x07e0) >> 5] << 8
| convert_5to8[(pixel & 0x001f)];
dst_line[x] = 0xff000000u
| convert_5to8[(pixel & 0xf800u) >> 11] << 16
| convert_6to8[(pixel & 0x07e0u) >> 5] << 8
| convert_5to8[(pixel & 0x001fu)];
}
}
}
......
......@@ -283,8 +283,8 @@ static void convert_l4a4_unorm(const BYTE *src, BYTE *dst, UINT src_row_pitch, U
for (x = 0; x < width; x++ )
{
unsigned char color = (*Source++);
/* A */ Dest[1] = (color & 0xf0) << 0;
/* L */ Dest[0] = (color & 0x0f) << 4;
/* A */ Dest[1] = (color & 0xf0u) << 0;
/* L */ Dest[0] = (color & 0x0fu) << 4;
Dest += 2;
}
}
......@@ -311,9 +311,9 @@ static void convert_r5g5_snorm_l6_unorm(const BYTE *src, BYTE *dst, UINT src_row
texel_in = (const unsigned short *)(src + z * src_slice_pitch + y * src_row_pitch);
for (x = 0; x < width; x++ )
{
l_in = (*texel_in & 0xfc00) >> 10;
g_in = (*texel_in & 0x03e0) >> 5;
r_in = *texel_in & 0x001f;
l_in = (*texel_in & 0xfc00u) >> 10;
g_in = (*texel_in & 0x03e0u) >> 5;
r_in = *texel_in & 0x001fu;
*texel_out = ((r_in + 16) << 11) | (l_in << 5) | (g_in + 16);
texel_out++;
......@@ -338,9 +338,9 @@ static void convert_r5g5_snorm_l6_unorm_ext(const BYTE *src, BYTE *dst, UINT src
texel_out = dst + z * dst_slice_pitch + y * dst_row_pitch;
for (x = 0; x < width; x++ )
{
l_in = (*texel_in & 0xfc00) >> 10;
g_in = (*texel_in & 0x03e0) >> 5;
r_in = *texel_in & 0x001f;
l_in = (*texel_in & 0xfc00u) >> 10;
g_in = (*texel_in & 0x03e0u) >> 5;
r_in = *texel_in & 0x001fu;
r_out = r_in << 3;
if (!(r_in & 0x10)) /* r > 0 */
......@@ -385,9 +385,9 @@ static void convert_r5g5_snorm_l6_unorm_nv(const BYTE *src, BYTE *dst, UINT src_
texel_out = dst + z * dst_slice_pitch + y * dst_row_pitch;
for (x = 0; x < width; x++ )
{
l_in = (*texel_in & 0xfc00) >> 10;
g_in = (*texel_in & 0x03e0) >> 5;
r_in = *texel_in & 0x001f;
l_in = (*texel_in & 0xfc00u) >> 10;
g_in = (*texel_in & 0x03e0u) >> 5;
r_in = *texel_in & 0x001fu;
ds_out = r_in << 3;
if (!(r_in & 0x10)) /* r > 0 */
......@@ -657,7 +657,7 @@ static void convert_s8_uint_d24_float(const BYTE *src, BYTE *dst, UINT src_row_p
for (x = 0; x < width; ++x)
{
dest_f[x * 2] = float_24_to_32((source[x] & 0xffffff00) >> 8);
dest_f[x * 2] = float_24_to_32((source[x] & 0xffffff00u) >> 8);
dest_s[x * 2 + 1] = source[x] & 0xff;
}
}
......@@ -724,9 +724,9 @@ static void convert_b5g6r5_unorm_b5g5r5a1_unorm_color_key(const BYTE *src, unsig
{
WORD src_color = src_row[x];
if (!color_in_range(color_key, src_color))
dst_row[x] = 0x8000 | ((src_color & 0xffc0) >> 1) | (src_color & 0x1f);
dst_row[x] = 0x8000u | ((src_color & 0xffc0u) >> 1) | (src_color & 0x1fu);
else
dst_row[x] = ((src_color & 0xffc0) >> 1) | (src_color & 0x1f);
dst_row[x] = ((src_color & 0xffc0u) >> 1) | (src_color & 0x1fu);
}
}
}
......@@ -1875,10 +1875,10 @@ static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_for
checkGLcall("Post-pixelshader blending check");
a = color >> 24;
r = (color & 0x00ff0000) >> 16;
r = (color & 0x00ff0000u) >> 16;
r_range = format->red_size < 8 ? 1 << (8 - format->red_size) : 1;
a_range = format->alpha_size < 8 ? 1 << (8 - format->alpha_size) : 1;
r_range = format->red_size < 8 ? 1u << (8 - format->red_size) : 1;
a_range = format->alpha_size < 8 ? 1u << (8 - format->alpha_size) : 1;
if (format->red_size && (r < 0x7f - r_range || r > 0x7f + r_range))
match = FALSE;
else if (format->alpha_size > 1 && (a < 0xbf - a_range || a > 0xbf + a_range))
......@@ -2735,7 +2735,7 @@ float wined3d_adapter_find_polyoffset_scale(struct wined3d_caps_gl_ctx *ctx, GLe
if (wined3d_settings.offscreen_rendering_mode != ORM_FBO)
{
FIXME("No FBOs, assuming polyoffset scale of 2^%u.\n", fallback);
return (float)(1 << fallback);
return (float)(1u << fallback);
}
gl_info->gl_ops.gl.p_glGenTextures(1, &color);
......@@ -2773,7 +2773,7 @@ float wined3d_adapter_find_polyoffset_scale(struct wined3d_caps_gl_ctx *ctx, GLe
gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/* The post viewport transform Z of the geometry runs from 0.0 to 0.5. We want to push it another
* 0.25 so that the Z buffer content (0.5) cuts the quad off at half the screen. */
gl_info->gl_ops.gl.p_glPolygonOffset(0.0f, (float)(1 << cur) * 0.25f);
gl_info->gl_ops.gl.p_glPolygonOffset(0.0f, (float)(1u << cur) * 0.25f);
draw_test_quad(ctx, geometry, &blue);
checkGLcall("Test draw");
......@@ -2804,7 +2804,7 @@ float wined3d_adapter_find_polyoffset_scale(struct wined3d_caps_gl_ctx *ctx, GLe
gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_TEST);
gl_info->gl_ops.gl.p_glDisable(GL_POLYGON_OFFSET_FILL);
return (float)(1 << cur);
return (float)(1u << cur);
}
const struct wined3d_format *wined3d_get_format(const struct wined3d_gl_info *gl_info,
......@@ -3883,12 +3883,12 @@ void get_texture_matrix(const struct wined3d_context *context, const struct wine
compute_texture_matrix(gl_info, &state->transforms[WINED3D_TS_TEXTURE0 + tex],
state->texture_states[tex][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS],
generated, context->last_was_rhw,
context->stream_info.use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coord_idx))
context->stream_info.use_map & (1u << (WINED3D_FFP_TEXCOORD0 + coord_idx))
? context->stream_info.elements[WINED3D_FFP_TEXCOORD0 + coord_idx].format->id
: WINED3DFMT_UNKNOWN,
device->shader_backend->shader_has_ffp_proj_control(device->shader_priv), mat);
if ((context->lastWasPow2Texture & (1 << tex)) && state->textures[tex])
if ((context->lastWasPow2Texture & (1u << tex)) && state->textures[tex])
{
if (generated)
FIXME("Non-power-of-two texture being used with generated texture coords.\n");
......@@ -4145,7 +4145,7 @@ DWORD wined3d_format_convert_from_float(const struct wined3d_surface *surface, c
static float color_to_float(DWORD color, DWORD size, DWORD offset)
{
DWORD mask = (1 << size) - 1;
DWORD mask = (1u << size) - 1;
if (!size)
return 1.0f;
......@@ -4792,7 +4792,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct
settings->transformed = 1;
settings->point_size = state->gl_primitive_type == GL_POINTS;
settings->per_vertex_point_size = !!(si->use_map & 1 << WINED3D_FFP_PSIZE);
settings->per_vertex_point_size = !!(si->use_map & 1u << WINED3D_FFP_PSIZE);
if (!state->render_states[WINED3D_RS_FOGENABLE])
settings->fog_mode = WINED3D_FFP_VS_FOG_OFF;
else if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE)
......@@ -4803,8 +4803,8 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct
for (i = 0; i < MAX_TEXTURES; ++i)
{
coord_idx = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
if (coord_idx < MAX_TEXTURES && (si->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coord_idx))))
settings->texcoords |= 1 << i;
if (coord_idx < MAX_TEXTURES && (si->use_map & (1u << (WINED3D_FFP_TEXCOORD0 + coord_idx))))
settings->texcoords |= 1u << i;
settings->texgen[i] = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
}
return;
......@@ -4826,14 +4826,14 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct
settings->transformed = 0;
settings->clipping = state->render_states[WINED3D_RS_CLIPPING]
&& state->render_states[WINED3D_RS_CLIPPLANEENABLE];
settings->normal = !!(si->use_map & (1 << WINED3D_FFP_NORMAL));
settings->normal = !!(si->use_map & (1u << WINED3D_FFP_NORMAL));
settings->normalize = settings->normal && state->render_states[WINED3D_RS_NORMALIZENORMALS];
settings->lighting = !!state->render_states[WINED3D_RS_LIGHTING];
settings->localviewer = !!state->render_states[WINED3D_RS_LOCALVIEWER];
settings->point_size = state->gl_primitive_type == GL_POINTS;
settings->per_vertex_point_size = !!(si->use_map & 1 << WINED3D_FFP_PSIZE);
settings->per_vertex_point_size = !!(si->use_map & 1u << WINED3D_FFP_PSIZE);
if (state->render_states[WINED3D_RS_COLORVERTEX] && (si->use_map & (1 << WINED3D_FFP_DIFFUSE)))
if (state->render_states[WINED3D_RS_COLORVERTEX] && (si->use_map & (1u << WINED3D_FFP_DIFFUSE)))
{
settings->diffuse_source = state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE];
settings->emissive_source = state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE];
......@@ -4852,8 +4852,8 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct
for (i = 0; i < MAX_TEXTURES; ++i)
{
coord_idx = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
if (coord_idx < MAX_TEXTURES && (si->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coord_idx))))
settings->texcoords |= 1 << i;
if (coord_idx < MAX_TEXTURES && (si->use_map & (1u << (WINED3D_FFP_TEXCOORD0 + coord_idx))))
settings->texcoords |= 1u << i;
settings->texgen[i] = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
}
......
......@@ -127,10 +127,10 @@ static inline struct color_fixup_desc create_complex_fixup_desc(enum complex_fix
{
struct color_fixup_desc fixup =
{
0, complex_fixup & (1 << 0) ? CHANNEL_SOURCE_COMPLEX1 : CHANNEL_SOURCE_COMPLEX0,
0, complex_fixup & (1 << 1) ? CHANNEL_SOURCE_COMPLEX1 : CHANNEL_SOURCE_COMPLEX0,
0, complex_fixup & (1 << 2) ? CHANNEL_SOURCE_COMPLEX1 : CHANNEL_SOURCE_COMPLEX0,
0, complex_fixup & (1 << 3) ? CHANNEL_SOURCE_COMPLEX1 : CHANNEL_SOURCE_COMPLEX0,
0u, complex_fixup & (1u << 0) ? CHANNEL_SOURCE_COMPLEX1 : CHANNEL_SOURCE_COMPLEX0,
0u, complex_fixup & (1u << 1) ? CHANNEL_SOURCE_COMPLEX1 : CHANNEL_SOURCE_COMPLEX0,
0u, complex_fixup & (1u << 2) ? CHANNEL_SOURCE_COMPLEX1 : CHANNEL_SOURCE_COMPLEX0,
0u, complex_fixup & (1u << 3) ? CHANNEL_SOURCE_COMPLEX1 : CHANNEL_SOURCE_COMPLEX0,
};
return fixup;
}
......@@ -156,10 +156,10 @@ static inline BOOL is_same_fixup(struct color_fixup_desc f1, struct color_fixup_
static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup)
{
enum complex_fixup complex_fixup = 0;
if (fixup.x_source == CHANNEL_SOURCE_COMPLEX1) complex_fixup |= (1 << 0);
if (fixup.y_source == CHANNEL_SOURCE_COMPLEX1) complex_fixup |= (1 << 1);
if (fixup.z_source == CHANNEL_SOURCE_COMPLEX1) complex_fixup |= (1 << 2);
if (fixup.w_source == CHANNEL_SOURCE_COMPLEX1) complex_fixup |= (1 << 3);
if (fixup.x_source == CHANNEL_SOURCE_COMPLEX1) complex_fixup |= (1u << 0);
if (fixup.y_source == CHANNEL_SOURCE_COMPLEX1) complex_fixup |= (1u << 1);
if (fixup.z_source == CHANNEL_SOURCE_COMPLEX1) complex_fixup |= (1u << 2);
if (fixup.w_source == CHANNEL_SOURCE_COMPLEX1) complex_fixup |= (1u << 3);
return complex_fixup;
}
......@@ -214,9 +214,9 @@ static inline GLenum wined3d_gl_min_mip_filter(enum wined3d_texture_filter_type
*/
static inline float float_16_to_32(const unsigned short *in)
{
const unsigned short s = ((*in) & 0x8000);
const unsigned short e = ((*in) & 0x7c00) >> 10;
const unsigned short m = (*in) & 0x3ff;
const unsigned short s = ((*in) & 0x8000u);
const unsigned short e = ((*in) & 0x7c00u) >> 10;
const unsigned short m = (*in) & 0x3ffu;
const float sgn = (s ? -1.0f : 1.0f);
if(e == 0) {
......@@ -232,9 +232,9 @@ static inline float float_16_to_32(const unsigned short *in)
static inline float float_24_to_32(DWORD in)
{
const float sgn = in & 0x800000 ? -1.0f : 1.0f;
const unsigned short e = (in & 0x780000) >> 19;
const unsigned int m = in & 0x7ffff;
const float sgn = in & 0x800000u ? -1.0f : 1.0f;
const unsigned short e = (in & 0x780000u) >> 19;
const unsigned int m = in & 0x7ffffu;
if (e == 0)
{
......@@ -364,7 +364,7 @@ enum wined3d_immconst_type
WINED3D_IMMCONST_VEC4,
};
#define WINED3DSP_NOSWIZZLE (0 | (1 << 2) | (2 << 4) | (3 << 6))
#define WINED3DSP_NOSWIZZLE (0u | (1u << 2) | (2u << 4) | (3u << 6))
enum wined3d_shader_src_modifier
{
......@@ -384,11 +384,11 @@ enum wined3d_shader_src_modifier
WINED3DSPSM_NOT = 13,
};
#define WINED3DSP_WRITEMASK_0 0x1 /* .x r */
#define WINED3DSP_WRITEMASK_1 0x2 /* .y g */
#define WINED3DSP_WRITEMASK_2 0x4 /* .z b */
#define WINED3DSP_WRITEMASK_3 0x8 /* .w a */
#define WINED3DSP_WRITEMASK_ALL 0xf /* all */
#define WINED3DSP_WRITEMASK_0 0x1u /* .x r */
#define WINED3DSP_WRITEMASK_1 0x2u /* .y g */
#define WINED3DSP_WRITEMASK_2 0x4u /* .z b */
#define WINED3DSP_WRITEMASK_3 0x8u /* .w a */
#define WINED3DSP_WRITEMASK_ALL 0xfu /* all */
enum wined3d_shader_dst_modifier
{
......@@ -413,11 +413,11 @@ enum wined3d_shader_rel_op
WINED3D_SHADER_REL_OP_LE = 6,
};
#define WINED3D_SM1_VS 0xfffe
#define WINED3D_SM1_PS 0xffff
#define WINED3D_SM4_PS 0x0000
#define WINED3D_SM4_VS 0x0001
#define WINED3D_SM4_GS 0x0002
#define WINED3D_SM1_VS 0xfffeu
#define WINED3D_SM1_PS 0xffffu
#define WINED3D_SM4_PS 0x0000u
#define WINED3D_SM4_VS 0x0001u
#define WINED3D_SM4_GS 0x0002u
/* Shader version tokens, and shader end tokens */
#define WINED3DPS_VERSION(major, minor) ((WINED3D_SM1_PS << 16) | ((major) << 8) | (minor))
......@@ -810,11 +810,11 @@ enum wined3d_ffp_ps_fog_mode
* into the shader code
*/
#define WINED3D_PSARGS_PROJECTED (1 << 3)
#define WINED3D_PSARGS_PROJECTED (1u << 3)
#define WINED3D_PSARGS_TEXTRANSFORM_SHIFT 4
#define WINED3D_PSARGS_TEXTRANSFORM_MASK 0xf
#define WINED3D_PSARGS_TEXTRANSFORM_MASK 0xfu
#define WINED3D_PSARGS_TEXTYPE_SHIFT 2
#define WINED3D_PSARGS_TEXTYPE_MASK 0x3
#define WINED3D_PSARGS_TEXTYPE_MASK 0x3u
/* Used for Shader Model 1 pixel shaders to track the bound texture
* type. 2D and RECT textures are separated through NP2 fixup. */
......@@ -1897,10 +1897,10 @@ enum wined3d_ffp_vs_fog_mode
};
#define WINED3D_FFP_TCI_SHIFT 16
#define WINED3D_FFP_TCI_MASK 0xff
#define WINED3D_FFP_TCI_MASK 0xffu
#define WINED3D_FFP_LIGHT_TYPE_SHIFT(idx) (3 * (idx))
#define WINED3D_FFP_LIGHT_TYPE_MASK 0x7
#define WINED3D_FFP_LIGHT_TYPE_MASK 0x7u
struct wined3d_ffp_vs_settings
{
......@@ -2128,7 +2128,7 @@ static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD sta
{
DWORD idx = state / (sizeof(*context->isStateDirty) * CHAR_BIT);
BYTE shift = state & ((sizeof(*context->isStateDirty) * CHAR_BIT) - 1);
return context->isStateDirty[idx] & (1 << shift);
return context->isStateDirty[idx] & (1u << shift);
}
#define WINED3D_RESOURCE_ACCESS_GPU 0x1
......@@ -3255,6 +3255,6 @@ static inline void context_apply_state(struct wined3d_context *context,
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
#define WINED3D_OPENGL_WINDOW_CLASS_NAME "WineD3D_OpenGL"
#define MAKEDWORD_VERSION(maj, min) (((maj & 0xffff) << 16) | (min & 0xffff))
#define MAKEDWORD_VERSION(maj, min) (((maj & 0xffffu) << 16) | (min & 0xffffu))
#endif
......@@ -724,9 +724,9 @@ struct wined3d_query_data_timestamp_disjoint
BOOL disjoint;
};
#define WINED3DISSUE_BEGIN (1 << 1)
#define WINED3DISSUE_END (1 << 0)
#define WINED3DGETDATA_FLUSH (1 << 0)
#define WINED3DISSUE_BEGIN (1u << 1)
#define WINED3DISSUE_END (1u << 0)
#define WINED3DGETDATA_FLUSH (1u << 0)
enum wined3d_stateblock_type
{
......@@ -797,10 +797,10 @@ enum wined3d_display_rotation
WINED3D_DISPLAY_ROTATION_270 = 4,
};
#define WINED3DCOLORWRITEENABLE_RED (1 << 0)
#define WINED3DCOLORWRITEENABLE_GREEN (1 << 1)
#define WINED3DCOLORWRITEENABLE_BLUE (1 << 2)
#define WINED3DCOLORWRITEENABLE_ALPHA (1 << 3)
#define WINED3DCOLORWRITEENABLE_RED (1u << 0)
#define WINED3DCOLORWRITEENABLE_GREEN (1u << 1)
#define WINED3DCOLORWRITEENABLE_BLUE (1u << 2)
#define WINED3DCOLORWRITEENABLE_ALPHA (1u << 3)
#define WINED3DADAPTER_DEFAULT 0
#define WINED3DENUM_NO_WHQL_LEVEL 2
......@@ -875,12 +875,12 @@ enum wined3d_display_rotation
#define WINED3DPRESENT_INTERVAL_IMMEDIATE 0x80000000
#define WINED3DMAXUSERCLIPPLANES 32
#define WINED3DCLIPPLANE0 (1 << 0)
#define WINED3DCLIPPLANE1 (1 << 1)
#define WINED3DCLIPPLANE2 (1 << 2)
#define WINED3DCLIPPLANE3 (1 << 3)
#define WINED3DCLIPPLANE4 (1 << 4)
#define WINED3DCLIPPLANE5 (1 << 5)
#define WINED3DCLIPPLANE0 (1u << 0)
#define WINED3DCLIPPLANE1 (1u << 1)
#define WINED3DCLIPPLANE2 (1u << 2)
#define WINED3DCLIPPLANE3 (1u << 3)
#define WINED3DCLIPPLANE4 (1u << 4)
#define WINED3DCLIPPLANE5 (1u << 5)
/* FVF (Flexible Vertex Format) codes */
#define WINED3DFVF_RESERVED0 0x0001
......@@ -912,10 +912,10 @@ enum wined3d_display_rotation
#define WINED3DFVF_LASTBETA_D3DCOLOR 0x8000
#define WINED3DFVF_RESERVED2 0x6000
#define WINED3DFVF_TEXTUREFORMAT1 3
#define WINED3DFVF_TEXTUREFORMAT2 0
#define WINED3DFVF_TEXTUREFORMAT3 1
#define WINED3DFVF_TEXTUREFORMAT4 2
#define WINED3DFVF_TEXTUREFORMAT1 3u
#define WINED3DFVF_TEXTUREFORMAT2 0u
#define WINED3DFVF_TEXTUREFORMAT3 1u
#define WINED3DFVF_TEXTUREFORMAT4 2u
#define WINED3DFVF_TEXCOORDSIZE1(idx) (WINED3DFVF_TEXTUREFORMAT1 << (idx * 2 + 16))
#define WINED3DFVF_TEXCOORDSIZE2(idx) (WINED3DFVF_TEXTUREFORMAT2 << (idx * 2 + 16))
#define WINED3DFVF_TEXCOORDSIZE3(idx) (WINED3DFVF_TEXTUREFORMAT3 << (idx * 2 + 16))
......@@ -927,8 +927,8 @@ enum wined3d_display_rotation
#define WINED3DCLEAR_STENCIL 0x00000004
/* Stream source flags */
#define WINED3DSTREAMSOURCE_INDEXEDDATA (1 << 30)
#define WINED3DSTREAMSOURCE_INSTANCEDATA (2 << 30)
#define WINED3DSTREAMSOURCE_INDEXEDDATA (1u << 30)
#define WINED3DSTREAMSOURCE_INSTANCEDATA (2u << 30)
/* SetPrivateData flags */
#define WINED3DSPD_IUNKNOWN 0x00000001
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment