mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 06:41:13 +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:
parent
bc73abc5ff
commit
b264227691
1 changed files with 2 additions and 16 deletions
|
@ -203,31 +203,17 @@ VM_DEFINE_FUNCTION (ge, "ge?", 2)
|
||||||
* Numeric functions
|
* 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
|
#undef FUNC2
|
||||||
#define FUNC2(CFUNC,SFUNC) \
|
#define FUNC2(CFUNC,SFUNC) \
|
||||||
{ \
|
{ \
|
||||||
ARGS2 (x, y); \
|
ARGS2 (x, y); \
|
||||||
if (SCM_I_INUMP (x) && SCM_I_INUMP (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)) \
|
if (SCM_FIXABLE (n)) \
|
||||||
RETURN (SCM_I_MAKINUM (n)); \
|
RETURN (SCM_I_MAKINUM (n)); \
|
||||||
} \
|
} \
|
||||||
SYNC_REGISTER (); \
|
SYNC_REGISTER (); \
|
||||||
RETURN (SFUNC (x, y)); \
|
RETURN (SFUNC (x, y)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue