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:
parent
19374ad2de
commit
ca7b6f6869
1 changed files with 5 additions and 6 deletions
|
@ -486,12 +486,11 @@ VM_DEFINE_FUNCTION (159, ash, "ash", 2)
|
|||
if (SCM_I_INUMP (x) && SCM_I_INUMP (y))
|
||||
{
|
||||
if (SCM_I_INUM (y) < 0)
|
||||
{
|
||||
/* Right shift, will be a fixnum. */
|
||||
if (SCM_I_INUM (y) > -SCM_I_FIXNUM_BIT)
|
||||
RETURN (SCM_I_MAKINUM (SCM_I_INUM (x) >> -SCM_I_INUM (y)));
|
||||
/* fall through */
|
||||
}
|
||||
/* Right shift, will be a fixnum. */
|
||||
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. */
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue