mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
py/obj: Remove mp_generic_unary_op().
Since converting to variable sized slots in mp_obj_type_t, we can now reduce the code size a bit by removing mp_generic_unary_op() and the corresponding slots where it is used. Instead we just implement the generic `__hash__` operation in the runtime. Signed-off-by: David Lechner <david@pybricks.com>
This commit is contained in:
committed by
Damien George
parent
53cb073571
commit
eaccaa3677
@@ -314,6 +314,9 @@ mp_obj_t mp_unary_op(mp_unary_op_t op, mp_obj_t arg) {
|
||||
if (result != MP_OBJ_NULL) {
|
||||
return result;
|
||||
}
|
||||
} else if (op == MP_UNARY_OP_HASH) {
|
||||
// Type doesn't have unary_op so use hash of object instance.
|
||||
return MP_OBJ_NEW_SMALL_INT((mp_uint_t)arg);
|
||||
}
|
||||
if (op == MP_UNARY_OP_BOOL) {
|
||||
// Type doesn't have unary_op (or didn't handle MP_UNARY_OP_BOOL),
|
||||
|
||||
Reference in New Issue
Block a user