1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 22:10:21 +02:00

fetch an inum's bits into a scm_bits_t, not an int

* libguile/vm-i-scheme.c (FUNC1): Remove, cause it's not used.
  (FUNC2): Don't assume an inum can fit into an int, use scm_bits_t
  instead. In reality though we should probably do use different checks,
  i.e. for multiplication probably we overflow. (That would be a bug.)

Based on a patch by C. K. Jester-Young <cky944 <at> gmail.com>.
This commit is contained in:
Andy Wingo 2008-08-26 13:40:07 -07:00
parent bc73abc5ff
commit b264227691

View file

@ -203,31 +203,17 @@ VM_DEFINE_FUNCTION (ge, "ge?", 2)
* Numeric functions
*/
#undef FUNC1
#define FUNC1(CEXP,SEXP) \
{ \
ARGS1 (x); \
if (SCM_I_INUMP (x)) \
{ \
int n = CEXP; \
if (SCM_FIXABLE (n)) \
RETURN (SCM_I_MAKINUM (n)); \
} \
SYNC_REGISTER (); \
RETURN (SEXP); \
}
#undef FUNC2
#define FUNC2(CFUNC,SFUNC) \
{ \
ARGS2 (x, y); \
if (SCM_I_INUMP (x) && SCM_I_INUMP (y)) \
{ \
int n = SCM_I_INUM (x) CFUNC SCM_I_INUM (y); \
scm_t_bits n = SCM_I_INUM (x) CFUNC SCM_I_INUM (y);\
if (SCM_FIXABLE (n)) \
RETURN (SCM_I_MAKINUM (n)); \
} \
SYNC_REGISTER (); \
SYNC_REGISTER (); \
RETURN (SFUNC (x, y)); \
}