mirror of
https://github.com/micropython/micropython.git
synced 2025-08-31 15:00:40 +02:00
all: Convert mp_uint_t to mp_unary_op_t/mp_binary_op_t where appropriate
The unary-op/binary-op enums are already defined, and there are no arithmetic tricks used with these types, so it makes sense to use the correct enum type for arguments that take these values. It also reduces code size quite a bit for nan-boxing builds.
This commit is contained in:
@@ -63,7 +63,7 @@ STATIC mp_obj_t bool_make_new(const mp_obj_type_t *type_in, size_t n_args, size_
|
||||
}
|
||||
}
|
||||
|
||||
STATIC mp_obj_t bool_unary_op(mp_uint_t op, mp_obj_t o_in) {
|
||||
STATIC mp_obj_t bool_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
|
||||
if (op == MP_UNARY_OP_LEN) {
|
||||
return MP_OBJ_NULL;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ STATIC mp_obj_t bool_unary_op(mp_uint_t op, mp_obj_t o_in) {
|
||||
return mp_unary_op(op, MP_OBJ_NEW_SMALL_INT(self->value));
|
||||
}
|
||||
|
||||
STATIC mp_obj_t bool_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
|
||||
STATIC mp_obj_t bool_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
|
||||
mp_obj_bool_t *self = MP_OBJ_TO_PTR(lhs_in);
|
||||
return mp_binary_op(op, MP_OBJ_NEW_SMALL_INT(self->value), rhs_in);
|
||||
}
|
||||
|
Reference in New Issue
Block a user