We're already using compiler-provided __*_TYPE__ macros, so instead of basing
BYTES_PER_LONG on __i386__ or __x86_64__, just use __SIZEOF_LONG__ directly.
This form doesn't require editing to add different architectures.
Add some build assertions that we have a half-way sane compile environment.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
xtf_exit();
}
+/**
+ * Some basic assertions about the compile environment.
+ */
+static void __maybe_unused build_assertions(void)
+{
+ BUILD_BUG_ON(BITS_PER_LONG != 32 &&
+ BITS_PER_LONG != 64);
+}
+
/*
* Local variables:
* mode: C
#define CHAR_BIT __CHAR_BIT__
+#define BYTES_PER_LONG __SIZEOF_LONG__
+#define BITS_PER_LONG (BYTES_PER_LONG * CHAR_BIT)
+
#endif /* LIMITS_H */
/*
#include <xtf/console.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))