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

(scm_logbit_p): Correction to test above the end of an

inum.  Reported by Jan Konecny.
This commit is contained in:
Kevin Ryde 2004-05-09 22:33:29 +00:00
parent 1dccbf7f5f
commit 0d75f6d819

View file

@ -1483,7 +1483,11 @@ SCM_DEFINE (scm_logbit_p, "logbit?", 2, 0, 0,
iindex = (unsigned long int) SCM_INUM (index);
if (SCM_INUMP (j))
return SCM_BOOL ((1L << iindex) & SCM_INUM (j));
{
/* bits above what's in an inum follow the sign bit */
iindex = min (iindex, LONG_BIT-1);
return SCM_BOOL ((1L << iindex) & SCM_INUM (j));
}
else if (SCM_BIGP (j))
{
int val = mpz_tstbit (SCM_I_BIG_MPZ (j), iindex);