diff options
Diffstat (limited to 'py/objint_mpz.c')
-rw-r--r-- | py/objint_mpz.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/py/objint_mpz.c b/py/objint_mpz.c index 6e1c3c5a84..c60e5c2b83 100644 --- a/py/objint_mpz.c +++ b/py/objint_mpz.c @@ -96,6 +96,14 @@ char *mp_obj_int_formatted_impl(char **buf, int *buf_size, int *fmt_size, mp_con return str; } +mp_int_t mp_obj_int_hash(mp_obj_t self_in) { + if (MP_OBJ_IS_SMALL_INT(self_in)) { + return MP_OBJ_SMALL_INT_VALUE(self_in); + } + mp_obj_int_t *self = self_in; + return mpz_hash(&self->mpz); +} + bool mp_obj_int_is_positive(mp_obj_t self_in) { if (MP_OBJ_IS_SMALL_INT(self_in)) { return MP_OBJ_SMALL_INT_VALUE(self_in) >= 0; |