py/runtime: Refactor default case of switch to remove assert(0).

This commit is contained in:
Damien George 2017-01-17 17:03:56 +11:00
parent 5bea080737
commit d7150b09d7
1 changed files with 2 additions and 4 deletions

View File

@ -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