summaryrefslogtreecommitdiff
path: root/unix/mpconfig.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2013-12-30 12:08:18 +0000
committerDamien George <damien.p.george@gmail.com>2013-12-30 12:08:18 +0000
commitcd340c44c28e2b07513fbe4d921a7eccca2dcd7a (patch)
treeb3851d4e7b1a51cf2ee03f8b375a78d183aabf60 /unix/mpconfig.h
parent046147dcd52ec8b8195ab1c1ff20fb1e7f510dda (diff)
parente85c38992da1f62fc07ee8e203ea98a221857b59 (diff)
Merge branch 'cross-plat' of https://github.com/pfalcon/micropython into pfalcon-cross-plat
Diffstat (limited to 'unix/mpconfig.h')
-rw-r--r--unix/mpconfig.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/unix/mpconfig.h b/unix/mpconfig.h
index a358d7db8..3d0dc8a56 100644
--- a/unix/mpconfig.h
+++ b/unix/mpconfig.h
@@ -8,10 +8,22 @@
// type definitions for the specific machine
-#define BYTES_PER_WORD (8)
+#ifdef __LP64__
+typedef long machine_int_t; // must be pointer size
+typedef unsigned long machine_uint_t; // must be pointer size
+#define UINT_FMT "%lu"
+#define INT_FMT "%ld"
+#else
+// These are definitions for machines where sizeof(int) == sizeof(void*),
+// regardless for actual size.
+typedef int machine_int_t; // must be pointer size
+typedef unsigned int machine_uint_t; // must be pointer size
+#define UINT_FMT "%u"
+#define INT_FMT "%d"
+#endif
+
+#define BYTES_PER_WORD sizeof(machine_int_t)
-typedef int64_t machine_int_t; // must be pointer size
-typedef uint64_t machine_uint_t; // must be pointer size
typedef void *machine_ptr_t; // must be of pointer size
typedef const void *machine_const_ptr_t; // must be of pointer size
typedef double machine_float_t;