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

VM: ash: Use SCM_SRS and handle large right shift in fast path.

* libguile/vm-i-scheme.c (ash): Use SCM_SRS.  Handle inum right shift by
  more than SCM_I_FIXNUM_BIT-1 bits in fast path.
This commit is contained in:
Mark H Weaver 2013-08-06 16:38:32 -04:00
parent 19374ad2de
commit ca7b6f6869

View file

@ -486,12 +486,11 @@ VM_DEFINE_FUNCTION (159, ash, "ash", 2)
if (SCM_I_INUMP (x) && SCM_I_INUMP (y)) if (SCM_I_INUMP (x) && SCM_I_INUMP (y))
{ {
if (SCM_I_INUM (y) < 0) if (SCM_I_INUM (y) < 0)
{ /* Right shift, will be a fixnum. */
/* Right shift, will be a fixnum. */ RETURN (SCM_I_MAKINUM
if (SCM_I_INUM (y) > -SCM_I_FIXNUM_BIT) (SCM_SRS (SCM_I_INUM (x),
RETURN (SCM_I_MAKINUM (SCM_I_INUM (x) >> -SCM_I_INUM (y))); (-SCM_I_INUM (y) <= SCM_I_FIXNUM_BIT-1)
/* fall through */ ? -SCM_I_INUM (y) : SCM_I_FIXNUM_BIT-1)));
}
else else
/* Left shift. See comments in scm_ash. */ /* Left shift. See comments in scm_ash. */
{ {