rainbowio: No need for the ternary here

.. mp_obj_get_float handles the case where the arg is an int already.

This saves 12 bytes of code size on trinket_m0.
This commit is contained in:
Jeff Epler 2021-11-12 17:28:57 -06:00
parent d4dd06904a
commit 9646d3f963
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
1 changed files with 2 additions and 1 deletions

View File

@ -37,7 +37,8 @@
//| ...
//|
STATIC mp_obj_t rainbowio_colorwheel(mp_obj_t n) {
return MP_OBJ_NEW_SMALL_INT(colorwheel(mp_obj_is_small_int(n) ? MP_OBJ_SMALL_INT_VALUE(n) : mp_obj_get_float(n)));
mp_float_t f = mp_obj_get_float(n);
return MP_OBJ_NEW_SMALL_INT(colorwheel(f));
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(rainbowio_colorwheel_obj, rainbowio_colorwheel);