diff options
author | Damien George <damien.p.george@gmail.com> | 2016-09-27 23:05:51 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-09-27 23:05:51 +1000 |
commit | c71edaed73e7c000747b58da8d9c8c807b519d07 (patch) | |
tree | 18827aa9a5820233dac759bf1b50bcd721a26db3 /py/objfun.c | |
parent | 88ca7ff5657aa6328f394a099cf52a76707ae943 (diff) | |
download | micropython-c71edaed73e7c000747b58da8d9c8c807b519d07.tar.gz micropython-c71edaed73e7c000747b58da8d9c8c807b519d07.zip |
py/objfun: Remove unnecessary check for viper fun with 5 or more args.
The native emitter/compiler restricts viper functions to 4 args, so there
is no need for an extra check in the dynamic dispatch.
Diffstat (limited to 'py/objfun.c')
-rw-r--r-- | py/objfun.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/py/objfun.c b/py/objfun.c index 3fd25fb224..fd51dd589d 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -409,17 +409,15 @@ STATIC mp_obj_t fun_viper_call(mp_obj_t self_in, size_t n_args, size_t n_kw, con ret = ((viper_fun_2_t)fun)(mp_convert_obj_to_native(args[0], self->type_sig >> 4), mp_convert_obj_to_native(args[1], self->type_sig >> 8)); } else if (n_args == 3) { ret = ((viper_fun_3_t)fun)(mp_convert_obj_to_native(args[0], self->type_sig >> 4), mp_convert_obj_to_native(args[1], self->type_sig >> 8), mp_convert_obj_to_native(args[2], self->type_sig >> 12)); - } else if (n_args == 4) { + } else { + // compiler allows at most 4 arguments + assert(n_args == 4); ret = ((viper_fun_4_t)fun)( mp_convert_obj_to_native(args[0], self->type_sig >> 4), mp_convert_obj_to_native(args[1], self->type_sig >> 8), mp_convert_obj_to_native(args[2], self->type_sig >> 12), mp_convert_obj_to_native(args[3], self->type_sig >> 16) ); - } else { - // TODO 5 or more arguments not supported for viper call - assert(0); - ret = 0; } return mp_convert_native_to_obj(ret, self->type_sig); |