aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/include/misc.h
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/include/misc.h')
-rw-r--r--nx-X11/programs/Xserver/include/misc.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/include/misc.h b/nx-X11/programs/Xserver/include/misc.h
index 5f30823fa..d2cadace2 100644
--- a/nx-X11/programs/Xserver/include/misc.h
+++ b/nx-X11/programs/Xserver/include/misc.h
@@ -81,6 +81,7 @@ extern unsigned long serverGeneration;
#include <nx-X11/Xfuncproto.h>
#include <nx-X11/Xmd.h>
#include <nx-X11/X.h>
+#include <stdint.h>
#ifndef _XTYPEDEF_POINTER
/* Don't let Xdefs.h define 'pointer' */
@@ -237,6 +238,28 @@ pad_to_int32(const int bytes) {
return (((bytes) + 3) & ~3);
}
+/**
+ * Compare the two version numbers comprising of major.minor.
+ *
+ * @return A value less than 0 if a is less than b, 0 if a is equal to b,
+ * or a value greater than 0
+ */
+static inline int
+version_compare(uint32_t a_major, uint32_t a_minor,
+ uint32_t b_major, uint32_t b_minor)
+{
+ if (a_major > b_major)
+ return 1;
+ if (a_major < b_major)
+ return -1;
+ if (a_minor > b_minor)
+ return 1;
+ if (a_minor < b_minor)
+ return -1;
+
+ return 0;
+}
+
/* some macros to help swap requests, replies, and events */
#define LengthRestB(stuff) \