py: Removing dangling "else" to improve code format consistency.
This commit is contained in:
parent
4b23e98fb0
commit
a1b18b3ba7
|
@ -297,9 +297,9 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte *p
|
||||||
if (mp_obj_is_type(val_in, &mp_type_int)) {
|
if (mp_obj_is_type(val_in, &mp_type_int)) {
|
||||||
mp_obj_int_to_bytes_impl(val_in, struct_type == '>', size, p);
|
mp_obj_int_to_bytes_impl(val_in, struct_type == '>', size, p);
|
||||||
return;
|
return;
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
val = mp_obj_get_int(val_in);
|
val = mp_obj_get_int(val_in);
|
||||||
// zero/sign extend if needed
|
// zero/sign extend if needed
|
||||||
if (BYTES_PER_WORD < 8 && size > sizeof(val)) {
|
if (BYTES_PER_WORD < 8 && size > sizeof(val)) {
|
||||||
|
@ -309,7 +309,7 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte *p
|
||||||
p += size - sizeof(val);
|
p += size - sizeof(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_binary_set_int(MIN((size_t)size, sizeof(val)), struct_type == '>', p, val);
|
mp_binary_set_int(MIN((size_t)size, sizeof(val)), struct_type == '>', p, val);
|
||||||
|
|
|
@ -521,8 +521,10 @@ STATIC void emit_inline_thumb_op(emit_inline_asm_t *emit, qstr op, mp_uint_t n_a
|
||||||
} else {
|
} else {
|
||||||
goto unknown_op;
|
goto unknown_op;
|
||||||
}
|
}
|
||||||
} else
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (n_args == 0) {
|
if (n_args == 0) {
|
||||||
if (op == MP_QSTR_nop) {
|
if (op == MP_QSTR_nop) {
|
||||||
asm_thumb_op16(&emit->as, ASM_THUMB_OP_NOP);
|
asm_thumb_op16(&emit->as, ASM_THUMB_OP_NOP);
|
||||||
|
|
|
@ -2318,15 +2318,19 @@ STATIC void emit_native_binary_op(emit_t *emit, mp_binary_op_t op) {
|
||||||
int reg_rhs = REG_ARG_3;
|
int reg_rhs = REG_ARG_3;
|
||||||
emit_pre_pop_reg_flexible(emit, &vtype_rhs, ®_rhs, REG_RET, REG_ARG_2);
|
emit_pre_pop_reg_flexible(emit, &vtype_rhs, ®_rhs, REG_RET, REG_ARG_2);
|
||||||
emit_pre_pop_reg(emit, &vtype_lhs, REG_ARG_2);
|
emit_pre_pop_reg(emit, &vtype_lhs, REG_ARG_2);
|
||||||
|
|
||||||
#if !(N_X64 || N_X86)
|
#if !(N_X64 || N_X86)
|
||||||
|
if (op == MP_BINARY_OP_LSHIFT || op == MP_BINARY_OP_RSHIFT) {
|
||||||
if (op == MP_BINARY_OP_LSHIFT) {
|
if (op == MP_BINARY_OP_LSHIFT) {
|
||||||
ASM_LSL_REG_REG(emit->as, REG_ARG_2, reg_rhs);
|
ASM_LSL_REG_REG(emit->as, REG_ARG_2, reg_rhs);
|
||||||
emit_post_push_reg(emit, VTYPE_INT, REG_ARG_2);
|
} else {
|
||||||
} else if (op == MP_BINARY_OP_RSHIFT) {
|
|
||||||
ASM_ASR_REG_REG(emit->as, REG_ARG_2, reg_rhs);
|
ASM_ASR_REG_REG(emit->as, REG_ARG_2, reg_rhs);
|
||||||
|
}
|
||||||
emit_post_push_reg(emit, VTYPE_INT, REG_ARG_2);
|
emit_post_push_reg(emit, VTYPE_INT, REG_ARG_2);
|
||||||
} else
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (op == MP_BINARY_OP_OR) {
|
if (op == MP_BINARY_OP_OR) {
|
||||||
ASM_OR_REG_REG(emit->as, REG_ARG_2, reg_rhs);
|
ASM_OR_REG_REG(emit->as, REG_ARG_2, reg_rhs);
|
||||||
emit_post_push_reg(emit, VTYPE_INT, REG_ARG_2);
|
emit_post_push_reg(emit, VTYPE_INT, REG_ARG_2);
|
||||||
|
|
|
@ -141,8 +141,9 @@ STATIC mp_obj_t dict_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return e1 == NULL && e2 == NULL ? mp_const_true : mp_const_false;
|
return e1 == NULL && e2 == NULL ? mp_const_true : mp_const_false;
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mp_obj_is_type(rhs_in, &mp_type_dict)) {
|
if (mp_obj_is_type(rhs_in, &mp_type_dict)) {
|
||||||
mp_obj_dict_t *rhs = MP_OBJ_TO_PTR(rhs_in);
|
mp_obj_dict_t *rhs = MP_OBJ_TO_PTR(rhs_in);
|
||||||
if (o->map.used != rhs->map.used) {
|
if (o->map.used != rhs->map.used) {
|
||||||
|
|
|
@ -162,11 +162,9 @@ STATIC mp_obj_t float_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs
|
||||||
#if MICROPY_PY_BUILTINS_COMPLEX
|
#if MICROPY_PY_BUILTINS_COMPLEX
|
||||||
if (mp_obj_is_type(rhs_in, &mp_type_complex)) {
|
if (mp_obj_is_type(rhs_in, &mp_type_complex)) {
|
||||||
return mp_obj_complex_binary_op(op, lhs_val, 0, rhs_in);
|
return mp_obj_complex_binary_op(op, lhs_val, 0, rhs_in);
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
return mp_obj_float_binary_op(op, lhs_val, rhs_in);
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
return mp_obj_float_binary_op(op, lhs_val, rhs_in);
|
||||||
}
|
}
|
||||||
|
|
||||||
const mp_obj_type_t mp_type_float = {
|
const mp_obj_type_t mp_type_float = {
|
||||||
|
|
|
@ -460,7 +460,7 @@ STATIC mp_uint_t convert_obj_for_inline_asm(mp_obj_t obj) {
|
||||||
if (type == &mp_type_float) {
|
if (type == &mp_type_float) {
|
||||||
// convert float to int (could also pass in float registers)
|
// convert float to int (could also pass in float registers)
|
||||||
return (mp_int_t)mp_obj_float_get(obj);
|
return (mp_int_t)mp_obj_float_get(obj);
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
if (type == &mp_type_tuple || type == &mp_type_list) {
|
if (type == &mp_type_tuple || type == &mp_type_list) {
|
||||||
// pointer to start of tuple (could pass length, but then could use len(x) for that)
|
// pointer to start of tuple (could pass length, but then could use len(x) for that)
|
||||||
|
|
|
@ -202,7 +202,7 @@ mp_obj_t mp_obj_int_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_i
|
||||||
mp_float_t flhs = mpz_as_float(zlhs);
|
mp_float_t flhs = mpz_as_float(zlhs);
|
||||||
mp_float_t frhs = mpz_as_float(zrhs);
|
mp_float_t frhs = mpz_as_float(zrhs);
|
||||||
return mp_obj_new_float(flhs / frhs);
|
return mp_obj_new_float(flhs / frhs);
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (op >= MP_BINARY_OP_INPLACE_OR && op < MP_BINARY_OP_CONTAINS) {
|
if (op >= MP_BINARY_OP_INPLACE_OR && op < MP_BINARY_OP_CONTAINS) {
|
||||||
|
|
|
@ -1060,8 +1060,10 @@ void mp_load_method_maybe(mp_obj_t obj, qstr attr, mp_obj_t *dest) {
|
||||||
if (attr == MP_QSTR___class__) {
|
if (attr == MP_QSTR___class__) {
|
||||||
// a.__class__ is equivalent to type(a)
|
// a.__class__ is equivalent to type(a)
|
||||||
dest[0] = MP_OBJ_FROM_PTR(type);
|
dest[0] = MP_OBJ_FROM_PTR(type);
|
||||||
} else
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (attr == MP_QSTR___next__ && type->iternext != NULL) {
|
if (attr == MP_QSTR___next__ && type->iternext != NULL) {
|
||||||
dest[0] = MP_OBJ_FROM_PTR(&mp_builtin_next_obj);
|
dest[0] = MP_OBJ_FROM_PTR(&mp_builtin_next_obj);
|
||||||
dest[1] = obj;
|
dest[1] = obj;
|
||||||
|
|
Loading…
Reference in New Issue