diff options
author | Damien George <damien.p.george@gmail.com> | 2017-01-17 17:03:56 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-01-17 17:03:56 +1100 |
commit | d7150b09d752b48bfa5df66fd1438bbcca18eb09 (patch) | |
tree | f038738ae9a19729e46cc4687295fe1d5c79f26c /py | |
parent | 5bea080737ee4a22e2a99aa03743cdf4b6396b7d (diff) | |
download | micropython-d7150b09d752b48bfa5df66fd1438bbcca18eb09.tar.gz micropython-d7150b09d752b48bfa5df66fd1438bbcca18eb09.zip |
py/runtime: Refactor default case of switch to remove assert(0).
Diffstat (limited to 'py')
-rw-r--r-- | py/runtime.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/py/runtime.c b/py/runtime.c index 4a51c00b52..9d2c0ef465 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -220,11 +220,9 @@ mp_obj_t mp_unary_op(mp_uint_t op, mp_obj_t arg) { } else { return MP_OBJ_NEW_SMALL_INT(-val); } - case MP_UNARY_OP_INVERT: - return MP_OBJ_NEW_SMALL_INT(~val); default: - assert(0); - return arg; + assert(op == MP_UNARY_OP_INVERT); + return MP_OBJ_NEW_SMALL_INT(~val); } } else if (op == MP_UNARY_OP_HASH && MP_OBJ_IS_STR_OR_BYTES(arg)) { // fast path for hashing str/bytes |