Skip to content

Commit d46ca25

Browse files
committed
Fix some int casting that failed on 64 bit architecture.
1 parent 8c2b333 commit d46ca25

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

py/sequence.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ mp_obj_t mp_seq_index_obj(const mp_obj_t *items, uint len, uint n_args, const mp
155155
}
156156
}
157157

158-
for (uint i = start; i < stop; i++) {
158+
for (machine_uint_t i = start; i < stop; i++) {
159159
if (mp_obj_equal(items[i], value)) {
160160
// Common sense says this cannot overflow small int
161161
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
166166
}
167167

168168
mp_obj_t mp_seq_count_obj(const mp_obj_t *items, uint len, mp_obj_t value) {
169-
uint count = 0;
169+
machine_uint_t count = 0;
170170
for (uint i = 0; i < len; i++) {
171171
if (mp_obj_equal(items[i], value)) {
172172
count++;

unix/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static MP_DEFINE_CONST_FUN_OBJ_1(fdfile_close_obj, fdfile_close);
5050

5151
static mp_obj_t fdfile_fileno(mp_obj_t self_in) {
5252
mp_obj_fdfile_t *self = self_in;
53-
return MP_OBJ_NEW_SMALL_INT(self->fd);
53+
return MP_OBJ_NEW_SMALL_INT((machine_int_t)self->fd);
5454
}
5555
static MP_DEFINE_CONST_FUN_OBJ_1(fdfile_fileno_obj, fdfile_fileno);
5656

unix/socket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static MP_DEFINE_CONST_FUN_OBJ_1(socket_close_obj, socket_close);
8686

8787
static mp_obj_t socket_fileno(mp_obj_t self_in) {
8888
mp_obj_socket_t *self = self_in;
89-
return MP_OBJ_NEW_SMALL_INT(self->fd);
89+
return MP_OBJ_NEW_SMALL_INT((machine_int_t)self->fd);
9090
}
9191
static MP_DEFINE_CONST_FUN_OBJ_1(socket_fileno_obj, socket_fileno);
9292

0 commit comments

Comments
 (0)