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

(scm_bit_extract): Use SCM_SRS for signed right shift.

This commit is contained in:
Kevin Ryde 2004-04-22 01:21:39 +00:00
parent 10cc8b0197
commit d77ad56065

View file

@ -1823,10 +1823,8 @@ SCM_DEFINE (scm_bit_extract, "bit-extract", 3, 0, 0,
long int in = SCM_INUM (n);
/* When istart>=SCM_I_FIXNUM_BIT we can just limit the shift to
SCM_I_FIXNUM_BIT-1 to get either 0 or -1 per the sign of "in".
FIXME: This shift relies on signed right shifts being arithmetic,
which is not guaranteed by C99. */
in >>= MIN (istart, SCM_I_FIXNUM_BIT-1);
SCM_I_FIXNUM_BIT-1 to get either 0 or -1 per the sign of "in". */
in = SCM_SRS (in, MIN (istart, SCM_I_FIXNUM_BIT-1));
if (in < 0 && bits >= SCM_I_FIXNUM_BIT)
{