before the patch, `(ash 2 -1)' yielded arg-out-of-range error.
the fix is to `SCM_UNPACK (cnt)' before comparing it w/ zero.
this change was made to both branches of the `#ifdef SCM_BIGDIG'.

thi


---------------------------------------
Index: numbers.c
===================================================================
RCS file: /cvs/guile/guile/guile-core/libguile/numbers.c,v
retrieving revision 1.71
diff -c -p -w -c -r1.71 numbers.c
*** numbers.c   2000/03/18 08:44:04     1.71
--- numbers.c   2000/03/19 16:26:43
*************** SCM_DEFINE (scm_ash, "ash", 2, 0, 0,
*** 1068,1074 ****
    SCM res = SCM_PACK (SCM_INUM (n));
    SCM_VALIDATE_INUM (2,cnt);
  #ifdef SCM_BIGDIG
!   if (cnt < 0)
      {
        res = scm_integer_expt (SCM_MAKINUM (2), SCM_MAKINUM (-SCM_INUM (cnt)));
        if (SCM_NFALSEP (scm_negative_p (n)))
--- 1068,1074 ----
    SCM res = SCM_PACK (SCM_INUM (n));
    SCM_VALIDATE_INUM (2,cnt);
  #ifdef SCM_BIGDIG
!   if (SCM_UNPACK (cnt) < 0)
      {
        res = scm_integer_expt (SCM_MAKINUM (2), SCM_MAKINUM (-SCM_INUM (cnt)));
        if (SCM_NFALSEP (scm_negative_p (n)))
*************** SCM_DEFINE (scm_ash, "ash", 2, 0, 0,
*** 1080,1089 ****
    else
      return scm_product (n, scm_integer_expt (SCM_MAKINUM (2), cnt));
  #else
!   SCM_VALIDATE_INUM (1,n)
    cnt = SCM_INUM (cnt);
-   if (cnt < 0)
-     return SCM_MAKINUM (SCM_SRS (res, -cnt));
    res = SCM_MAKINUM (res << cnt);
    if (SCM_INUM (res) >> cnt != SCM_INUM (n))
      scm_num_overflow (FUNC_NAME);
--- 1080,1088 ----
    else
      return scm_product (n, scm_integer_expt (SCM_MAKINUM (2), cnt));
  #else
!   if (SCM_UNPACK (cnt) < 0)
!     return SCM_MAKINUM (SCM_SRS (res, -SCM_UNPACK (cnt)));
    cnt = SCM_INUM (cnt);
    res = SCM_MAKINUM (res << cnt);
    if (SCM_INUM (res) >> cnt != SCM_INUM (n))
      scm_num_overflow (FUNC_NAME);

Reply via email to