aboutsummaryrefslogtreecommitdiff
path: root/py/nativeglue.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-01-07 16:48:20 +0000
committerDamien George <damien.p.george@gmail.com>2016-01-07 16:48:20 +0000
commitdd0a0f79d777684aba7986d44fae1a6eff176151 (patch)
treeb1384ada473b9d091279f6d2af818f30166acd46 /py/nativeglue.c
parentdaa1a455c631b697eb536ea7fedc30fcd735eb65 (diff)
py/viper: Truncate viper integer args so they can be up to 32-bit.
Diffstat (limited to 'py/nativeglue.c')
-rw-r--r--py/nativeglue.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/py/nativeglue.c b/py/nativeglue.c
index 9c939c7ea..3220996f9 100644
--- a/py/nativeglue.c
+++ b/py/nativeglue.c
@@ -48,14 +48,13 @@ mp_uint_t mp_convert_obj_to_native(mp_obj_t obj, mp_uint_t type) {
switch (type & 3) {
case MP_NATIVE_TYPE_OBJ: return (mp_uint_t)obj;
case MP_NATIVE_TYPE_BOOL:
- case MP_NATIVE_TYPE_INT: return mp_obj_get_int(obj);
+ case MP_NATIVE_TYPE_INT: return mp_obj_get_int_truncated(obj);
case MP_NATIVE_TYPE_UINT: {
mp_buffer_info_t bufinfo;
if (mp_get_buffer(obj, &bufinfo, MP_BUFFER_RW)) {
return (mp_uint_t)bufinfo.buf;
} else {
- // TODO should be mp_obj_get_uint_truncated or something
- return mp_obj_get_int(obj);
+ return mp_obj_get_int_truncated(obj);
}
}
default: assert(0); return 0;