summaryrefslogtreecommitdiffstatshomepage
path: root/py/objstr.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-08-20 23:30:12 +0100
committerDamien George <damien.p.george@gmail.com>2015-10-20 12:35:17 +0100
commitaaef1851a748af95f8b105ef2d1d4f35e6ede02b (patch)
treedec9fac8e9ed288aa0b4a2abfed093208c2dd12e /py/objstr.c
parent60401d461ab41d94eeb174ae0f4db9a57d43880a (diff)
downloadmicropython-aaef1851a748af95f8b105ef2d1d4f35e6ede02b.tar.gz
micropython-aaef1851a748af95f8b105ef2d1d4f35e6ede02b.zip
py: Add mp_obj_is_float function (macro) and use it where appropriate.
Diffstat (limited to 'py/objstr.c')
-rw-r--r--py/objstr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/py/objstr.c b/py/objstr.c
index f94744af7f..6ada37b90c 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -827,15 +827,15 @@ STATIC bool arg_looks_integer(mp_obj_t arg) {
STATIC bool arg_looks_numeric(mp_obj_t arg) {
return arg_looks_integer(arg)
#if MICROPY_PY_BUILTINS_FLOAT
- || MP_OBJ_IS_TYPE(arg, &mp_type_float)
+ || mp_obj_is_float(arg)
#endif
;
}
STATIC mp_obj_t arg_as_int(mp_obj_t arg) {
#if MICROPY_PY_BUILTINS_FLOAT
- if (MP_OBJ_IS_TYPE(arg, &mp_type_float)) {
- return mp_obj_new_int_from_float(mp_obj_get_float(arg));
+ if (mp_obj_is_float(arg)) {
+ return mp_obj_new_int_from_float(mp_obj_float_get(arg));
}
#endif
return arg;