summaryrefslogtreecommitdiff
path: root/py/obj.h
diff options
context:
space:
mode:
authorYoctopuce dev <dev@yoctopuce.com>2025-06-30 23:28:20 +0200
committerDamien George <damien@micropython.org>2025-07-09 11:54:21 +1000
commitc4a88f2ce7da87d5f635ec25edba481917020fd8 (patch)
tree6d8c704092f58c09136d5bd41563a7c73c57e6f4 /py/obj.h
parent49159ef6b7e283681cb1c2dfe44cdf14bd397467 (diff)
py/obj: Add functions to retrieve large integers from mp_obj_t.
This commit provides helpers to retrieve integer values from mp_obj_t when the content does not fit in a 32 bits integer, without risking an implicit wrap due to an int overflow. Signed-off-by: Yoctopuce dev <dev@yoctopuce.com>
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/py/obj.h b/py/obj.h
index 0f87282a9..a1df661ff 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -1051,6 +1051,8 @@ static inline bool mp_obj_is_integer(mp_const_obj_t o) {
}
mp_int_t mp_obj_get_int(mp_const_obj_t arg);
+mp_uint_t mp_obj_get_uint(mp_const_obj_t arg);
+long long mp_obj_get_ll(mp_const_obj_t arg);
mp_int_t mp_obj_get_int_truncated(mp_const_obj_t arg);
bool mp_obj_get_int_maybe(mp_const_obj_t arg, mp_int_t *value);
#if MICROPY_PY_BUILTINS_FLOAT