]> xenbits.xensource.com Git - people/liuw/xtf.git/commitdiff
Provide {BITS,BYTES}_PER_LONG
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 23 May 2016 13:39:26 +0000 (13:39 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 23 May 2016 13:39:26 +0000 (14:39 +0100)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
include/xtf/lib.h

index 1bc7236353d1fa688cd063c91a748426e8301b7f..183db0f80f532fd01a60e000c0d01813a9db1a2b 100644 (file)
@@ -4,6 +4,17 @@
 #include <xtf/compiler.h>
 #include <xtf/types.h>
 
+#if defined(__i386__)
+# define BYTES_PER_LONG 4
+#elif defined(__x86_64__)
+# define BYTES_PER_LONG 8
+#else
+# errror Bad width
+#endif
+
+#define BITS_PER_LONG (BYTES_PER_LONG * 8)
+
+
 #define ARRAY_SIZE(a)    (sizeof(a) / sizeof(*a))
 
 #define ACCESS_ONCE(x)   (*(volatile typeof(x) *)&(x))