Fix some int casting that failed on 64 bit architecture.
This commit is contained in:
parent
8c2b333aff
commit
d46ca25757
@ -155,7 +155,7 @@ mp_obj_t mp_seq_index_obj(const mp_obj_t *items, uint len, uint n_args, const mp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint i = start; i < stop; i++) {
|
for (machine_uint_t i = start; i < stop; i++) {
|
||||||
if (mp_obj_equal(items[i], value)) {
|
if (mp_obj_equal(items[i], value)) {
|
||||||
// Common sense says this cannot overflow small int
|
// Common sense says this cannot overflow small int
|
||||||
return MP_OBJ_NEW_SMALL_INT(i);
|
return MP_OBJ_NEW_SMALL_INT(i);
|
||||||
@ -166,7 +166,7 @@ mp_obj_t mp_seq_index_obj(const mp_obj_t *items, uint len, uint n_args, const mp
|
|||||||
}
|
}
|
||||||
|
|
||||||
mp_obj_t mp_seq_count_obj(const mp_obj_t *items, uint len, mp_obj_t value) {
|
mp_obj_t mp_seq_count_obj(const mp_obj_t *items, uint len, mp_obj_t value) {
|
||||||
uint count = 0;
|
machine_uint_t count = 0;
|
||||||
for (uint i = 0; i < len; i++) {
|
for (uint i = 0; i < len; i++) {
|
||||||
if (mp_obj_equal(items[i], value)) {
|
if (mp_obj_equal(items[i], value)) {
|
||||||
count++;
|
count++;
|
||||||
|
@ -50,7 +50,7 @@ static MP_DEFINE_CONST_FUN_OBJ_1(fdfile_close_obj, fdfile_close);
|
|||||||
|
|
||||||
static mp_obj_t fdfile_fileno(mp_obj_t self_in) {
|
static mp_obj_t fdfile_fileno(mp_obj_t self_in) {
|
||||||
mp_obj_fdfile_t *self = self_in;
|
mp_obj_fdfile_t *self = self_in;
|
||||||
return MP_OBJ_NEW_SMALL_INT(self->fd);
|
return MP_OBJ_NEW_SMALL_INT((machine_int_t)self->fd);
|
||||||
}
|
}
|
||||||
static MP_DEFINE_CONST_FUN_OBJ_1(fdfile_fileno_obj, fdfile_fileno);
|
static MP_DEFINE_CONST_FUN_OBJ_1(fdfile_fileno_obj, fdfile_fileno);
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ static MP_DEFINE_CONST_FUN_OBJ_1(socket_close_obj, socket_close);
|
|||||||
|
|
||||||
static mp_obj_t socket_fileno(mp_obj_t self_in) {
|
static mp_obj_t socket_fileno(mp_obj_t self_in) {
|
||||||
mp_obj_socket_t *self = self_in;
|
mp_obj_socket_t *self = self_in;
|
||||||
return MP_OBJ_NEW_SMALL_INT(self->fd);
|
return MP_OBJ_NEW_SMALL_INT((machine_int_t)self->fd);
|
||||||
}
|
}
|
||||||
static MP_DEFINE_CONST_FUN_OBJ_1(socket_fileno_obj, socket_fileno);
|
static MP_DEFINE_CONST_FUN_OBJ_1(socket_fileno_obj, socket_fileno);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user