aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bignum.h12
-rw-r--r--src/emacs-module.c5
2 files changed, 13 insertions, 4 deletions
diff --git a/src/bignum.h b/src/bignum.h
index 4c670bd906f..743a18fc0f7 100644
--- a/src/bignum.h
+++ b/src/bignum.h
@@ -94,6 +94,18 @@ bignum_integer (mpz_t *tmp, Lisp_Object i)
94 return &XBIGNUM (i)->value; 94 return &XBIGNUM (i)->value;
95} 95}
96 96
97/* Set RESULT to the value stored in the Lisp integer I. If I is a
98 big integer, copy it to RESULT. RESULT must already be
99 initialized. */
100INLINE void
101mpz_set_integer (mpz_t result, Lisp_Object i)
102{
103 if (FIXNUMP (i))
104 mpz_set_intmax (result, XFIXNUM (i));
105 else
106 mpz_set (result, XBIGNUM (i)->value);
107}
108
97INLINE_HEADER_END 109INLINE_HEADER_END
98 110
99#endif /* BIGNUM_H */ 111#endif /* BIGNUM_H */
diff --git a/src/emacs-module.c b/src/emacs-module.c
index 6b56146ca01..1a7a21a4a8c 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -785,10 +785,7 @@ module_extract_big_integer (emacs_env *env, emacs_value value,
785 MODULE_FUNCTION_BEGIN (); 785 MODULE_FUNCTION_BEGIN ();
786 Lisp_Object o = value_to_lisp (value); 786 Lisp_Object o = value_to_lisp (value);
787 CHECK_INTEGER (o); 787 CHECK_INTEGER (o);
788 if (FIXNUMP (o)) 788 mpz_set_integer (result->value, o);
789 mpz_set_intmax (result->value, XFIXNUM (o));
790 else
791 mpz_set (result->value, XBIGNUM (o)->value);
792} 789}
793 790
794static emacs_value 791static emacs_value