8000 extmod/modubinascii: Fix crc32() function on 32-bit platforms. · sparkfun/circuitpython@7f5a541 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7f5a541

Browse files
prusnakpfalcon
authored andcommitted
extmod/modubinascii: Fix crc32() function on 32-bit platforms.
1 parent b84e123 commit 7f5a541

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

extmod/modubinascii.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ MP_DEFINE_CONST_FUN_OBJ_1(mod_binascii_b2a_base64_obj, mod_binascii_b2a_base64);
208208
mp_obj_t mod_binascii_crc32(size_t n_args, const mp_obj_t *args) {
209209
mp_buffer_info_t bufinfo;
210210
mp_get_buffer_raise(args[0], &bufinfo, MP_BUFFER_READ);
211-
uint32_t crc = (n_args > 1) ? mp_obj_get_int(args[1]) : 0;
211+
uint32_t crc = (n_args > 1) ? mp_obj_get_int_truncated(args[1]) : 0;
212212
crc = uzlib_crc32(bufinfo.buf, bufinfo.len, crc ^ 0xffffffff);
213-
return MP_OBJ_NEW_SMALL_INT(crc ^ 0xffffffff);
213+
return mp_obj_new_int_from_uint(crc ^ 0xffffffff);
214214
}
215215
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_binascii_crc32_obj, 1, 2, mod_binascii_crc32);
216216
#endif

0 commit comments

Comments
 (0)
0