summaryrefslogtreecommitdiff
path: root/py/obj.h
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-18 16:07:16 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-18 16:12:12 +0200
commitd26b379eec155ddd7a4aa64057c3d0507eee79f5 (patch)
tree33bc4d1857cf37f6150ad473fefdcc3354607b49 /py/obj.h
parent166bb40fb22b9c43209ce9792b6a8d48276ef7fa (diff)
int: Add value accessors: mp_obj_int_get() & mp_obj_int_get_checked().
mp_obj_int_get() can be used when just full resolution of C machine_int_t is required (returns truncated value of long int). mp_obj_int_get_checked() will throw exception if Python int value not representable in machine_int_t.
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/obj.h b/py/obj.h
index 99d430f49..4984548de 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -265,6 +265,10 @@ void mp_obj_cell_set(mp_obj_t self_in, mp_obj_t obj);
// int
extern const mp_obj_type_t int_type;
+// For long int, returns value truncated to machine_int_t
+machine_int_t mp_obj_int_get(mp_obj_t self_in);
+// Will rains exception if value doesn't fit into machine_int_t
+machine_int_t mp_obj_int_get_checked(mp_obj_t self_in);
// exception
extern const mp_obj_type_t exception_type;