Skip to content
Snippets Groups Projects
Commit 8de270b4 authored by Damien George's avatar Damien George
Browse files

py/objbool: Make a slight simplification of bool constructor.

Reduces code size for some archs.
parent eca1408f
No related branches found
No related tags found
No related merge requests found
...@@ -56,12 +56,10 @@ STATIC mp_obj_t bool_make_new(const mp_obj_type_t *type_in, size_t n_args, size_ ...@@ -56,12 +56,10 @@ STATIC mp_obj_t bool_make_new(const mp_obj_type_t *type_in, size_t n_args, size_
(void)type_in; (void)type_in;
mp_arg_check_num(n_args, n_kw, 0, 1, false); mp_arg_check_num(n_args, n_kw, 0, 1, false);
switch (n_args) { if (n_args == 0) {
case 0:
return mp_const_false; return mp_const_false;
case 1: } else {
default: // must be 0 or 1 return mp_obj_new_bool(mp_obj_is_true(args[0]));
if (mp_obj_is_true(args[0])) { return mp_const_true; } else { return mp_const_false; }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment