embed/extmod: add trezor_obj_get_uint8

pull/25/head
Jan Pochyla 6 years ago
parent 39c1c85abb
commit 648ec675f4

@ -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

Loading…
Cancel
Save