aboutsummaryrefslogtreecommitdiff
path: root/py/objint_mpz.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-12-21 11:46:27 +1100
committerDamien George <damien.p.george@gmail.com>2016-12-21 11:46:27 +1100
commite4af71212550d950269f6991be187f41dcf64eee (patch)
tree7602453f297f001f6ed7d96073d73836af323f6f /py/objint_mpz.c
parent67f3edc10af1833218af680835f75a3e2d0473e7 (diff)
py/objint: Rename mp_obj_int_as_float to mp_obj_int_as_float_impl.
And also simplify it to remove the check for small int. This can be done because this function is only ever called if the argument is not a small int.
Diffstat (limited to 'py/objint_mpz.c')
-rw-r--r--py/objint_mpz.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/py/objint_mpz.c b/py/objint_mpz.c
index 0a1d68598..eadf64fce 100644
--- a/py/objint_mpz.c
+++ b/py/objint_mpz.c
@@ -403,13 +403,10 @@ mp_int_t mp_obj_int_get_checked(mp_const_obj_t self_in) {
}
#if MICROPY_PY_BUILTINS_FLOAT
-mp_float_t mp_obj_int_as_float(mp_obj_t self_in) {
- if (MP_OBJ_IS_SMALL_INT(self_in)) {
- return MP_OBJ_SMALL_INT_VALUE(self_in);
- } else {
- mp_obj_int_t *self = MP_OBJ_TO_PTR(self_in);
- return mpz_as_float(&self->mpz);
- }
+mp_float_t mp_obj_int_as_float_impl(mp_obj_t self_in) {
+ assert(MP_OBJ_IS_TYPE(self_in, &mp_type_int));
+ mp_obj_int_t *self = MP_OBJ_TO_PTR(self_in);
+ return mpz_as_float(&self->mpz);
}
#endif