library: Fix LINUX_VERSION macro

The previous commit did not take into account operator evaluation
order so always gave 0. Fixed the macro and added some checks for
the macro.

References:
 commit 9abf7d879d
This commit is contained in:
Craig Small
2016-05-01 17:46:25 +10:00
parent 9abf7d879d
commit 19a515e314
2 changed files with 30 additions and 1 deletions

View File

@@ -29,7 +29,7 @@ __BEGIN_DECLS
int procps_linux_version(void);
/* Convenience macros for composing/decomposing version codes */
#define LINUX_VERSION(x,y,z) (0x10000*((x)&0x7fff) + 0x100*((y)&0xff) + (z)&0xff)
#define LINUX_VERSION(x,y,z) (0x10000*((x)&0x7fff) + 0x100*((y)&0xff) + ((z)&0xff))
#define LINUX_VERSION_MAJOR(x) (((x)>>16) & 0xFF)
#define LINUX_VERSION_MINOR(x) (((x)>> 8) & 0xFF)
#define LINUX_VERSION_PATCH(x) ( (x) & 0xFF)