summaryrefslogtreecommitdiff
path: root/py/objint.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-07-24 14:21:37 +0100
committerDamien George <damien.p.george@gmail.com>2014-07-24 14:21:37 +0100
commitffe911d228c3b7e35ef6ae775c802cdd05cffa47 (patch)
tree0cb1c7c2e8ef4724a8a8f2c21613e65d88cb69e0 /py/objint.c
parent4ecb700fe34491c563372ffa72387ef6d45ce5d8 (diff)
py: Make long ints hashable.
Addresses issue #765.
Diffstat (limited to 'py/objint.c')
-rw-r--r--py/objint.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/objint.c b/py/objint.c
index bca32d13f..e351c3f39 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -215,6 +215,10 @@ char *mp_obj_int_formatted(char **buf, int *buf_size, int *fmt_size, mp_const_ob
#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE
+mp_int_t mp_obj_int_hash(mp_obj_t self_in) {
+ return MP_OBJ_SMALL_INT_VALUE(self_in);
+}
+
bool mp_obj_int_is_positive(mp_obj_t self_in) {
return mp_obj_get_int(self_in) >= 0;
}