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

RTL VM: ash: Use SCM_SRS and fix large right shifts in fast path.

* libguile/vm-engine.c (ash): Use SCM_SRS, and handle large right
  shifts properly.
This commit is contained in:
Mark H Weaver 2013-08-06 16:51:41 -04:00
parent 78ff784784
commit 0bd659658b

View file

@ -2926,7 +2926,10 @@ RTL_VM_NAME (SCM vm, SCM program, SCM *argv, size_t nargs_)
{
if (SCM_I_INUM (y) < 0)
/* Right shift, will be a fixnum. */
RETURN (SCM_I_MAKINUM (SCM_I_INUM (x) >> -SCM_I_INUM (y)));
RETURN (SCM_I_MAKINUM
(SCM_SRS (SCM_I_INUM (x),
(-SCM_I_INUM (y) <= SCM_I_FIXNUM_BIT-1)
? -SCM_I_INUM (y) : SCM_I_FIXNUM_BIT-1)));
else
/* Left shift. See comments in scm_ash. */
{