Skip to content

Commit 9646d3f

Browse files
committed
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.
1 parent d4dd069 commit 9646d3f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

shared-bindings/rainbowio/__init__.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
//| ...
3838
//|
3939
STATIC mp_obj_t rainbowio_colorwheel(mp_obj_t n) {
40-
return MP_OBJ_NEW_SMALL_INT(colorwheel(mp_obj_is_small_int(n) ? MP_OBJ_SMALL_INT_VALUE(n) : mp_obj_get_float(n)));
40+
mp_float_t f = mp_obj_get_float(n);
41+
return MP_OBJ_NEW_SMALL_INT(colorwheel(f));
4142
}
4243
STATIC MP_DEFINE_CONST_FUN_OBJ_1(rainbowio_colorwheel_obj, rainbowio_colorwheel);
4344

0 commit comments

Comments
 (0)