summaryrefslogtreecommitdiff
path: root/py/mpconfig.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-11-03 12:33:01 +1100
committerDamien George <damien.p.george@gmail.com>2016-11-03 12:33:01 +1100
commit561844f3ba2dc81ce37c58468099042e27cd422b (patch)
tree95bc16e21265b3a517710325be39a50002b8afa2 /py/mpconfig.h
parentca973bd3083492777095a07c20965a4644899ec9 (diff)
py: Add MICROPY_FLOAT_CONST macro for defining float constants.
All float constants in the core should use this macro to prevent unnecessary creation of double-precision floats, which makes code less efficient.
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r--py/mpconfig.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index fd82b079c..3945a1a5a 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -505,10 +505,12 @@ typedef long long mp_longint_impl_t;
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
#define MICROPY_PY_BUILTINS_FLOAT (1)
+#define MICROPY_FLOAT_CONST(x) x##F
#define MICROPY_FLOAT_C_FUN(fun) fun##f
typedef float mp_float_t;
#elif MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE
#define MICROPY_PY_BUILTINS_FLOAT (1)
+#define MICROPY_FLOAT_CONST(x) x
#define MICROPY_FLOAT_C_FUN(fun) fun
typedef double mp_float_t;
#else