summaryrefslogtreecommitdiffstatshomepage
path: root/unix-cpy/mpconfig.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2013-12-30 12:52:32 +0000
committerDamien George <damien.p.george@gmail.com>2013-12-30 12:52:32 +0000
commit212c296c0b24dddd19099f9188176a14ade42d86 (patch)
tree50bdcb156669c1e6c77f0ba37206314f104196c4 /unix-cpy/mpconfig.h
parentcd340c44c28e2b07513fbe4d921a7eccca2dcd7a (diff)
downloadmicropython-212c296c0b24dddd19099f9188176a14ade42d86.tar.gz
micropython-212c296c0b24dddd19099f9188176a14ade42d86.zip
Make unix-cpy cross platform; remove dependency of asmx64 on mpconfig.
Diffstat (limited to 'unix-cpy/mpconfig.h')
-rw-r--r--unix-cpy/mpconfig.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/unix-cpy/mpconfig.h b/unix-cpy/mpconfig.h
index 9fe8a7ac2e..db72b31455 100644
--- a/unix-cpy/mpconfig.h
+++ b/unix-cpy/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;