aboutsummaryrefslogtreecommitdiff
path: root/py/mpconfig.h
diff options
context:
space:
mode:
authorDamien George2014-03-08 15:24:39 +0000
committerDamien George2014-03-08 15:24:39 +0000
commit0c36da0b59bd3d5aeb6f7bd7f75913695a1dd366 (patch)
treeeb1d8e50037139646f935df99da56764fcafb4f1 /py/mpconfig.h
parent8fd7d7e102372a3fe067030aa0f2049f744b1567 (diff)
Implement ROMable modules. Add math module.
mp_module_obj_t can now be put in ROM. Configuration of float type is now similar to longint: can now choose none, float or double as the implementation. math module has basic math functions. For STM port, these are not yet implemented (they are just stub functions).
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r--py/mpconfig.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 34c83d324..5b13c4648 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -84,8 +84,24 @@ typedef long long mp_longint_impl_t;
#define MICROPY_ENABLE_SOURCE_LINE (0)
#endif
-// Whether to support float and complex types
-#ifndef MICROPY_ENABLE_FLOAT
+// Float and complex implementation
+#define MICROPY_FLOAT_IMPL_NONE (0)
+#define MICROPY_FLOAT_IMPL_FLOAT (1)
+#define MICROPY_FLOAT_IMPL_DOUBLE (2)
+
+#ifndef MICROPY_FLOAT_IMPL
+#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
+#endif
+
+#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
+#define MICROPY_ENABLE_FLOAT (1)
+#define MICROPY_FLOAT_C_FUN(fun) fun##f
+typedef float mp_float_t;
+#elif MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE
+#define MICROPY_ENABLE_FLOAT (1)
+#define MICROPY_FLOAT_C_FUN(fun) fun
+typedef double mp_float_t;
+#else
#define MICROPY_ENABLE_FLOAT (0)
#endif