summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-03-08 15:24:39 +0000
committerDamien George <damien.p.george@gmail.com>2014-03-08 15:24:39 +0000
commit0c36da0b59bd3d5aeb6f7bd7f75913695a1dd366 (patch)
treeeb1d8e50037139646f935df99da56764fcafb4f1 /py/obj.c
parent8fd7d7e102372a3fe067030aa0f2049f744b1567 (diff)
downloadmicropython-0c36da0b59bd3d5aeb6f7bd7f75913695a1dd366.tar.gz
micropython-0c36da0b59bd3d5aeb6f7bd7f75913695a1dd366.zip
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/obj.c')
-rw-r--r--py/obj.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/py/obj.c b/py/obj.c
index 0068af4c43..0c97ee5aa3 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -165,14 +165,14 @@ machine_int_t mp_obj_get_int(mp_obj_t arg) {
}
#if MICROPY_ENABLE_FLOAT
-machine_float_t mp_obj_get_float(mp_obj_t arg) {
+mp_float_t mp_obj_get_float(mp_obj_t arg) {
if (arg == mp_const_false) {
return 0;
} else if (arg == mp_const_true) {
return 1;
} else if (MP_OBJ_IS_SMALL_INT(arg)) {
return MP_OBJ_SMALL_INT_VALUE(arg);
- } else if (MP_OBJ_IS_TYPE(arg, &float_type)) {
+ } else if (MP_OBJ_IS_TYPE(arg, &mp_type_float)) {
return mp_obj_float_get(arg);
} else {
nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "can't convert %s to float", mp_obj_get_type_str(arg)));
@@ -189,10 +189,10 @@ void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) {
} else if (MP_OBJ_IS_SMALL_INT(arg)) {
*real = MP_OBJ_SMALL_INT_VALUE(arg);
*imag = 0;
- } else if (MP_OBJ_IS_TYPE(arg, &float_type)) {
+ } else if (MP_OBJ_IS_TYPE(arg, &mp_type_float)) {
*real = mp_obj_float_get(arg);
*imag = 0;
- } else if (MP_OBJ_IS_TYPE(arg, &complex_type)) {
+ } else if (MP_OBJ_IS_TYPE(arg, &mp_type_complex)) {
mp_obj_complex_get(arg, real, imag);
} else {
nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "can't convert %s to complex", mp_obj_get_type_str(arg)));