summaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2014-02-08 16:12:09 +0200
committerRan Benita <ran234@gmail.com>2014-02-08 16:12:09 +0200
commitf5465b56a3ada7aaf7e9dfb4956ca4de8cb28911 (patch)
treeeeb10ddecb8422b1fa3366861693587b5d6eac44 /src/utils.h
parenta088c9ba772f829ff995a6d0767c1b6fcc879ec3 (diff)
downloadxorg-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>
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h6
1 files changed, 3 insertions, 3 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;
}