if (led->which_mods & XKB_STATE_MODS_LOCKED)
mod_mask |= state->components.locked_mods;
if (led->mods.mask & mod_mask)
- state->components.leds |= (1 << idx);
+ state->components.leds |= (1u << idx);
if (led->which_groups & XKB_STATE_LAYOUT_EFFECTIVE)
- group_mask |= (1 << state->components.group);
+ group_mask |= (1u << state->components.group);
if (led->which_groups & XKB_STATE_LAYOUT_DEPRESSED)
- group_mask |= (1 << state->components.base_group);
+ group_mask |= (1u << state->components.base_group);
if (led->which_groups & XKB_STATE_LAYOUT_LATCHED)
- group_mask |= (1 << state->components.latched_group);
+ group_mask |= (1u << state->components.latched_group);
if (led->which_groups & XKB_STATE_LAYOUT_LOCKED)
- group_mask |= (1 << state->components.locked_group);
+ group_mask |= (1u << state->components.locked_group);
if (led->groups & group_mask)
- state->components.leds |= (1 << idx);
+ state->components.leds |= (1u << idx);
if (led->ctrls & state->keymap->enabled_ctrls)
- state->components.leds |= (1 << idx);
+ state->components.leds |= (1u << idx);
}
}
num_mods = xkb_keymap_num_mods(state->keymap);
for (idx = 0; idx < num_mods; idx++) {
- xkb_mod_mask_t mod = (1 << idx);
+ xkb_mod_mask_t mod = (1u << idx);
if (base_mods & mod)
state->components.base_mods |= mod;
if (latched_mods & mod)
if (idx >= xkb_keymap_num_mods(state->keymap))
return -1;
- return !!(xkb_state_serialize_mods(state, type) & (1 << idx));
+ return !!(xkb_state_serialize_mods(state, type) & (1u << idx));
}
/**
ret = -1;
break;
}
- wanted |= (1 << idx);
+ wanted |= (1u << idx);
}
va_end(ap);
ret = -1;
break;
}
- wanted |= (1 << idx);
+ wanted |= (1u << idx);
}
va_end(ap);
darray_item(state->keymap->leds, idx).name == XKB_ATOM_NONE)
return -1;
- return !!(state->components.leds & (1 << idx));
+ return !!(state->components.leds & (1u << idx));
}
/**
if (!key || idx >= xkb_keymap_num_mods(state->keymap))
return -1;
- return !!((1 << idx) & key_get_consumed(state, key));
+ return !!((1u << idx) & key_get_consumed(state, key));
}
/**
darray_enumerate(i, mod, keymap->mods) {
int ret;
- if (!(mask & (1 << i)))
+ if (!(mask & (1u << i)))
continue;
ret = snprintf(buf + pos, sizeof(buf) - pos, "%s%s",
for (unsigned i = 0; mask; i++) {
int ret;
- if (!(mask & (1 << i)))
+ if (!(mask & (1u << i)))
continue;
- mask &= ~(1 << i);
+ mask &= ~(1u << i);
ret = snprintf(buf + pos, sizeof(buf) - pos, "%s%s",
pos == 0 ? "" : "+",
- LookupValue(modComponentMaskNames, 1 << i));
+ LookupValue(modComponentMaskNames, 1u << i));
if (ret <= 0 || pos + ret >= sizeof(buf))
break;
else
for (unsigned i = 0; mask; i++) {
int ret;
- if (!(mask & (1 << i)))
+ if (!(mask & (1u << i)))
continue;
- mask &= ~(1 << i);
+ mask &= ~(1u << i);
ret = snprintf(buf + pos, sizeof(buf) - pos, "%s%s",
pos == 0 ? "" : "+",
- LookupValue(ctrlMaskNames, 1 << i));
+ LookupValue(ctrlMaskNames, 1u << i));
if (ret <= 0 || pos + ret >= sizeof(buf))
break;
else
darray_resize0(keymap->leds, msb_pos(reply->which));
for (int i = 0; i < NUM_INDICATORS; i++) {
- if (reply->which & (1 << i)) {
+ if (reply->which & (1u << i)) {
xcb_xkb_indicator_map_t *wire = iter.data;
struct xkb_led *led = &darray_item(keymap->leds, i);
FAIL_UNLESS(msb_pos(reply->indicators) <= (int) darray_size(keymap->leds));
for (int i = 0; i < NUM_INDICATORS; i++) {
- if (reply->indicators & (1 << i)) {
+ if (reply->indicators & (1u << i)) {
xcb_atom_t wire = *iter;
struct xkb_led *led = &darray_item(keymap->leds, i);
if (ndx == XKB_MOD_INVALID)
return false;
- *val_rtrn = (1 << ndx);
+ *val_rtrn = (1u << ndx);
return true;
}
continue;
darray_enumerate(i, mod, keymap->mods)
- if (key->modmap & (1 << i))
+ if (key->modmap & (1u << i))
write_buf(buf, "\tmodifier_map %s { %s };\n",
xkb_atom_text(keymap->ctx, mod->name),
KeyNameText(keymap->ctx, key->name));
mods->mask = mods->mods & MOD_REAL_MASK_ALL;
darray_enumerate(i, mod, keymap->mods)
- if (mods->mods & (1 << i))
+ if (mods->mods & (1u << i))
mods->mask |= mod->mapping;
}
if ((group == 0 && level == 0) || !interp->level_one_only)
if (interp->virtual_mod != XKB_MOD_INVALID)
- vmodmap |= (1 << interp->virtual_mod);
+ vmodmap |= (1u << interp->virtual_mod);
if (interp->action.type != ACTION_TYPE_NONE)
key->groups[group].levels[level].action = interp->action;
/* Update keymap->mods, the virtual -> real mod mapping. */
xkb_foreach_key(key, keymap)
darray_enumerate(i, mod, keymap->mods)
- if (key->vmodmap & (1 << i))
+ if (key->vmodmap & (1u << i))
mod->mapping |= key->modmap;
/* Now update the level masks for all the types to reflect the vmods. */
return;
}
- if (m->mapping.defined_mlvo_mask & (1 << mlvo)) {
+ if (m->mapping.defined_mlvo_mask & (1u << mlvo)) {
matcher_error(m,
"invalid mapping: %.*s appears twice on the same line; "
"ignoring rule set",
}
m->mapping.mlvo_at_pos[m->mapping.num_mlvo] = mlvo;
- m->mapping.defined_mlvo_mask |= 1 << mlvo;
+ m->mapping.defined_mlvo_mask |= 1u << mlvo;
m->mapping.num_mlvo++;
}
return;
}
- if (m->mapping.defined_kccgst_mask & (1 << kccgst)) {
+ if (m->mapping.defined_kccgst_mask & (1u << kccgst)) {
matcher_error(m,
"invalid mapping: %.*s appears twice on the same line; "
"ignoring rule set",
}
m->mapping.kccgst_at_pos[m->mapping.num_kccgst] = kccgst;
- m->mapping.defined_kccgst_mask |= 1 << kccgst;
+ m->mapping.defined_kccgst_mask |= 1u << kccgst;
m->mapping.num_kccgst++;
}
* See the "Notes" section in the overview above.
*/
- if (m->mapping.defined_mlvo_mask & (1 << MLVO_LAYOUT)) {
+ if (m->mapping.defined_mlvo_mask & (1u << MLVO_LAYOUT)) {
if (m->mapping.layout_idx == XKB_LAYOUT_INVALID) {
if (darray_size(m->rmlvo.layouts) > 1)
goto skip;
}
}
- if (m->mapping.defined_mlvo_mask & (1 << MLVO_VARIANT)) {
+ if (m->mapping.defined_mlvo_mask & (1u << MLVO_VARIANT)) {
if (m->mapping.variant_idx == XKB_LAYOUT_INVALID) {
if (darray_size(m->rmlvo.variants) > 1)
goto skip;
}
}
- key->modmap |= (1 << entry->modifier);
+ key->modmap |= (1u << entry->modifier);
return true;
}