aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/machine.h
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-13 17:44:52 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-14 00:40:52 +0100
commitd66213e883fdbb1d3c9738def00a1debc6e3e2b9 (patch)
tree450914a3f26d95e55e37010523909e114eb0ffef /machine.h
parentce50c885b8b0c6fac6f2ce02b999f3726651080f (diff)
downloadsparse-dev-d66213e883fdbb1d3c9738def00a1debc6e3e2b9.tar.gz
Consolidate 'machine detection' into "machine.h"
The file "lib.c' contains some defines and have some #ifdefery to detect the data model of the native machine (LP32/LP64). Same for the native endianness. Move these into "machine.h" where the platform detection is already done. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'machine.h')
-rw-r--r--machine.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/machine.h b/machine.h
index a01cdc20..1eacb556 100644
--- a/machine.h
+++ b/machine.h
@@ -1,6 +1,29 @@
#ifndef MACHINE_H
#define MACHINE_H
+#ifdef __BIG_ENDIAN__
+#define ARCH_BIG_ENDIAN 1
+#else
+#define ARCH_BIG_ENDIAN 0
+#endif
+
+
+enum {
+ ARCH_LP32,
+ ARCH_X32,
+ ARCH_LP64,
+ ARCH_LLP64,
+};
+
+#ifdef __LP64__
+#define ARCH_M64_DEFAULT ARCH_LP64
+#elif defined(__x86_64__) || defined(__x86_64)
+#define ARCH_M64_DEFAULT ARCH_X32
+#else
+#define ARCH_M64_DEFAULT ARCH_LP32
+#endif
+
+
enum machine {
MACH_ARM,
MACH_ARM64,