summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/xkbcommon/src/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/xkbcommon/src/utils.h')
-rw-r--r--src/3rdparty/xkbcommon/src/utils.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/3rdparty/xkbcommon/src/utils.h b/src/3rdparty/xkbcommon/src/utils.h
index 81d1cc9412..878c2ac1e3 100644
--- a/src/3rdparty/xkbcommon/src/utils.h
+++ b/src/3rdparty/xkbcommon/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;
}
@@ -187,6 +187,22 @@ unmap_file(const char *str, size_t size);
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MAX3(a, b, c) MAX(MAX((a), (b)), (c))
+#if defined(HAVE_SECURE_GETENV)
+# define secure_getenv secure_getenv
+#elif defined(HAVE___SECURE_GETENV)
+# define secure_getenv __secure_getenv
+#else
+# define secure_getenv getenv
+#endif
+
+#if defined(HAVE___BUILTIN_EXPECT)
+# define likely(x) __builtin_expect(!!(x), 1)
+# define unlikely(x) __builtin_expect(!!(x), 0)
+#else
+# define likely(x) (x)
+# define unlikely(x) (x)
+#endif
+
/* Compiler Attributes */
#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__CYGWIN__)