mirror of
https://github.com/m5stack/M5Stack_MicroPython.git
synced 2026-09-17 00:30:38 -07:00
MicroPython core updated to the latest commit (bcfff4f, 2018-03-30)
'Ctrl+D' on empty line now performs full ESP32 soft reset 'math' module updated, added 'factorial' method 'uos' module updated, added 'mpycore' method to show MicroPython core git commit hash and date
This commit is contained in:
@@ -222,27 +222,26 @@ size_t mp_int_format_size(size_t num_bits, int base, const char *prefix, char co
|
||||
char *mp_obj_int_formatted(char **buf, size_t *buf_size, size_t *fmt_size, mp_const_obj_t self_in,
|
||||
int base, const char *prefix, char base_char, char comma) {
|
||||
fmt_int_t num;
|
||||
#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE
|
||||
// Only have small ints; get the integer value to format.
|
||||
num = MP_OBJ_SMALL_INT_VALUE(self_in);
|
||||
#else
|
||||
if (MP_OBJ_IS_SMALL_INT(self_in)) {
|
||||
// A small int; get the integer value to format.
|
||||
num = MP_OBJ_SMALL_INT_VALUE(self_in);
|
||||
#if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
|
||||
} else if (MP_OBJ_IS_TYPE(self_in, &mp_type_int)) {
|
||||
} else {
|
||||
assert(MP_OBJ_IS_TYPE(self_in, &mp_type_int));
|
||||
// Not a small int.
|
||||
#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_LONGLONG
|
||||
#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_LONGLONG
|
||||
const mp_obj_int_t *self = self_in;
|
||||
// Get the value to format; mp_obj_get_int truncates to mp_int_t.
|
||||
num = self->val;
|
||||
#else
|
||||
#else
|
||||
// Delegate to the implementation for the long int.
|
||||
return mp_obj_int_formatted_impl(buf, buf_size, fmt_size, self_in, base, prefix, base_char, comma);
|
||||
#endif
|
||||
#endif
|
||||
} else {
|
||||
// Not an int.
|
||||
**buf = '\0';
|
||||
*fmt_size = 0;
|
||||
return *buf;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
char sign = '\0';
|
||||
if (num < 0) {
|
||||
@@ -378,7 +377,7 @@ mp_obj_t mp_obj_int_binary_op_extra_cases(mp_binary_op_t op, mp_obj_t lhs_in, mp
|
||||
// true acts as 0
|
||||
return mp_binary_op(op, lhs_in, MP_OBJ_NEW_SMALL_INT(1));
|
||||
} else if (op == MP_BINARY_OP_MULTIPLY) {
|
||||
if (MP_OBJ_IS_STR(rhs_in) || MP_OBJ_IS_TYPE(rhs_in, &mp_type_bytes) || MP_OBJ_IS_TYPE(rhs_in, &mp_type_tuple) || MP_OBJ_IS_TYPE(rhs_in, &mp_type_list)) {
|
||||
if (MP_OBJ_IS_STR_OR_BYTES(rhs_in) || MP_OBJ_IS_TYPE(rhs_in, &mp_type_tuple) || MP_OBJ_IS_TYPE(rhs_in, &mp_type_list)) {
|
||||
// multiply is commutative for these types, so delegate to them
|
||||
return mp_binary_op(op, rhs_in, lhs_in);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user