py: Implement mp_obj_new_int_from_float() for MICROPY_LONGINT_IMPL_NONE.
diff --git a/py/objint.c b/py/objint.c
index 8f62619..0aa281e 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -262,6 +262,14 @@
     return mp_const_none;
 }
 
+#if MICROPY_PY_BUILTINS_FLOAT
+mp_obj_t mp_obj_new_int_from_float(mp_float_t val) {
+    // TODO raise an exception if the int won't fit
+    mp_int_t i = MICROPY_FLOAT_C_FUN(trunc)(val);
+    return mp_obj_new_int(i);
+}
+#endif
+
 mp_obj_t mp_obj_new_int(mp_int_t value) {
     if (MP_SMALL_INT_FITS(value)) {
         return MP_OBJ_NEW_SMALL_INT(value);