summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2013-08-06 16:38:32 -0400
committerMark H Weaver <mhw@netris.org>2013-08-06 16:38:32 -0400
commitca7b6f6869072a79175c2d2db1b63f706bdf9b25 (patch)
tree915356ca9fd9872e3279c7dc6739785aab504ec2
parent19374ad2dec5529cbe4c82faf26247a57d09ce4d (diff)
downloadguile-ca7b6f6869072a79175c2d2db1b63f706bdf9b25.tar.gz
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.
-rw-r--r--libguile/vm-i-scheme.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/libguile/vm-i-scheme.c b/libguile/vm-i-scheme.c
index bcd8134e2..fc32ec5a8 100644
--- a/libguile/vm-i-scheme.c
+++ b/libguile/vm-i-scheme.c
@@ -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. */
{