diff options
author | Ran Benita <ran234@gmail.com> | 2014-02-08 16:12:09 +0200 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2014-02-08 16:12:09 +0200 |
commit | f5465b56a3ada7aaf7e9dfb4956ca4de8cb28911 (patch) | |
tree | eeb10ddecb8422b1fa3366861693587b5d6eac44 | |
parent | a088c9ba772f829ff995a6d0767c1b6fcc879ec3 (diff) | |
download | xorg-lib-libxkbcommon-f5465b56a3ada7aaf7e9dfb4956ca4de8cb28911.tar.gz |
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>
-rw-r--r-- | src/utils.h | 6 | ||||
-rw-r--r-- | src/x11/keymap.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/utils.h b/src/utils.h index 6affee1..878c2ac 100644 --- a/src/utils.h +++ b/src/utils.h @@ -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; } diff --git a/src/x11/keymap.c b/src/x11/keymap.c index 8581a79..51b0219 100644 --- a/src/x11/keymap.c +++ b/src/x11/keymap.c @@ -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)) { |