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:
parent
d4dd06904a
commit
9646d3f963
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue