summaryrefslogtreecommitdiff
path: root/py/obj.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-12-05 23:13:52 +0000
committerDamien George <damien.p.george@gmail.com>2014-12-05 23:13:52 +0000
commitbe6d8be91e133e98117025062df0e63aaf87efd2 (patch)
tree692495154f547612c148312b4abc0afc3f4a50d6 /py/obj.h
parent451a0870753be89f5a284fd39727705a3ad2109b (diff)
py: Rename mp_obj_int_get to mp_obj_int_get_truncated; fix struct.pack.
mp_obj_int_get_truncated is used as a "fast path" int accessor that doesn't check for overflow and returns the int truncated to the machine word size, ie mp_int_t. Use mp_obj_int_get_truncated to fix struct.pack when packing maximum word sized values. Addresses issues #779 and #998.
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/py/obj.h b/py/obj.h
index febff67c2..3721bea92 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -460,12 +460,12 @@ void mp_obj_cell_set(mp_obj_t self_in, mp_obj_t obj);
// int
// For long int, returns value truncated to mp_int_t
-mp_int_t mp_obj_int_get(mp_const_obj_t self_in);
+mp_int_t mp_obj_int_get_truncated(mp_const_obj_t self_in);
+// Will raise exception if value doesn't fit into mp_int_t
+mp_int_t mp_obj_int_get_checked(mp_const_obj_t self_in);
#if MICROPY_PY_BUILTINS_FLOAT
mp_float_t mp_obj_int_as_float(mp_obj_t self_in);
#endif
-// Will raise exception if value doesn't fit into mp_int_t
-mp_int_t mp_obj_int_get_checked(mp_const_obj_t self_in);
// exception
#define mp_obj_is_native_exception_instance(o) (mp_obj_get_type(o)->make_new == mp_obj_exception_make_new)