1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-23 07:58:09 +00:00

use mp_obj_new_int_from_uint when returning uint32

This commit is contained in:
Pavol Rusnak 2016-09-21 18:06:34 +02:00
parent d5942d664c
commit 5c3e0c9b6f
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -29,7 +29,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Random_uniform(mp_obj_t self, mp_obj_t n) {
if (nn == 0) { if (nn == 0) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Maximum can't be zero")); nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Maximum can't be zero"));
} }
return MP_OBJ_NEW_SMALL_INT(random_uniform(nn)); return mp_obj_new_int_from_uint(random_uniform(nn));
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Random_uniform_obj, mod_TrezorCrypto_Random_uniform); STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Random_uniform_obj, mod_TrezorCrypto_Random_uniform);