1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00

embed/extmod: add trezor_obj_get_uint8

This commit is contained in:
Jan Pochyla 2018-05-16 14:27:51 +02:00
parent 39c1c85abb
commit 648ec675f4

View File

@ -69,4 +69,12 @@ static inline mp_uint_t trezor_obj_get_uint(mp_obj_t obj) {
}
}
static inline uint8_t trezor_obj_get_uint8(mp_obj_t obj) {
mp_uint_t u = trezor_obj_get_uint(obj);
if (u > 0xFF) {
mp_raise_msg(&mp_type_OverflowError, "value does not fit into byte type");
}
return u;
}
#endif