* src/bignum.h (mpz_set_integer): New function.
* src/emacs-module.c (module_make_big_integer): Use it.
return &XBIGNUM (i)->value;
}
+/* Set RESULT to the value stored in the Lisp integer I. If I is a
+ big integer, copy it to RESULT. RESULT must already be
+ initialized. */
+INLINE void
+mpz_set_integer (mpz_t result, Lisp_Object i)
+{
+ if (FIXNUMP (i))
+ mpz_set_intmax (result, XFIXNUM (i));
+ else
+ mpz_set (result, XBIGNUM (i)->value);
+}
+
INLINE_HEADER_END
#endif /* BIGNUM_H */
MODULE_FUNCTION_BEGIN ();
Lisp_Object o = value_to_lisp (value);
CHECK_INTEGER (o);
- if (FIXNUMP (o))
- mpz_set_intmax (result->value, XFIXNUM (o));
- else
- mpz_set (result->value, XBIGNUM (o)->value);
+ mpz_set_integer (result->value, o);
}
static emacs_value