* src/emacs-module.c: Do not include bignum.h; no longer needed.
(module_extract_integer): Use bignum_to_intmax to avoid
incorrectly signaling overflow on platforms where intmax_t
is wider than long int.
#include <stdio.h>
#include "lisp.h"
-#include "bignum.h"
#include "dynlib.h"
#include "coding.h"
#include "keyboard.h"
CHECK_INTEGER (l);
if (BIGNUMP (l))
{
- /* FIXME: This can incorrectly signal overflow on platforms
- where long is narrower than intmax_t. */
- if (!mpz_fits_slong_p (XBIGNUM (l)->value))
+ intmax_t i = bignum_to_intmax (l);
+ if (i == 0)
xsignal1 (Qoverflow_error, l);
- return mpz_get_si (XBIGNUM (l)->value);
+ return i;
}
return XFIXNUM (l);
}