py/objstr: Split mp_obj_str_from_vstr into bytes/str versions.
Previously the desired output type was specified. Now make the type part
of the function name. Because this function is used in a few places this
saves code size due to smaller call-site.
This makes `mp_obj_new_str_type_from_vstr` a private function of objstr.c
(which is almost the only place where the output type isn't a compile-time
constant).
This saves ~140 bytes on PYBV11.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
diff --git a/py/objint.c b/py/objint.c
index 740e7ea..645b269 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -446,7 +446,7 @@
mp_binary_set_int(l, big_endian, data + (big_endian ? (len - l) : 0), val);
}
- return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
+ return mp_obj_new_bytes_from_vstr(&vstr);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(int_to_bytes_obj, 3, 4, int_to_bytes);