x11: make msb_pos return unsigned
It was initially returning -1 for all-zero arguments, but now it returns 0. Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
a088c9ba77
commit
f5465b56a3
|
@ -163,13 +163,13 @@ is_graph(char ch)
|
|||
* Note: this is 1-based! It's more useful this way, and returns 0 when
|
||||
* mask is all 0s.
|
||||
*/
|
||||
static inline int
|
||||
static inline unsigned
|
||||
msb_pos(uint32_t mask)
|
||||
{
|
||||
int pos = 0;
|
||||
unsigned pos = 0;
|
||||
while (mask) {
|
||||
pos++;
|
||||
mask >>= 1;
|
||||
mask >>= 1u;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
|
|
@ -883,7 +883,7 @@ get_indicator_names(struct xkb_keymap *keymap, xcb_connection_t *conn,
|
|||
{
|
||||
xcb_atom_t *iter = xcb_xkb_get_names_value_list_indicator_names(list);
|
||||
|
||||
FAIL_UNLESS(msb_pos(reply->indicators) <= (int) darray_size(keymap->leds));
|
||||
FAIL_UNLESS(msb_pos(reply->indicators) <= darray_size(keymap->leds));
|
||||
|
||||
for (int i = 0; i < NUM_INDICATORS; i++) {
|
||||
if (reply->indicators & (1u << i)) {
|
||||
|
|
Loading…
Reference in New Issue