[BACK]Return to igcdhack.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / engine

Diff for /OpenXM_contrib2/asir2000/engine/igcdhack.c between version 1.5 and 1.6

version 1.5, 2005/07/03 10:19:22 version 1.6, 2018/03/29 01:32:52
Line 45 
Line 45 
  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,   * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.   * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
  *   *
  * $OpenXM: OpenXM_contrib2/asir2000/engine/igcdhack.c,v 1.4 2000/12/21 02:51:45 murao Exp $   * $OpenXM: OpenXM_contrib2/asir2000/engine/igcdhack.c,v 1.5 2005/07/03 10:19:22 ohara Exp $
 */  */
 #if 0  #if 0
 #include "base.h"  #include "base.h"
Line 112  int *u, lu, *v, lv, *a;
Line 112  int *u, lu, *v, lv, *a;
  swap:   swap:
   SWAP( lu, lv, int );  SWAP( u, v, int * );    SWAP( lu, lv, int );  SWAP( u, v, int * );
   sign = -1;    sign = -1;
  U_V:   /* U > V, i.e., (lu > lv) || (lu == lv && u[lu-1] > v[lv-1]) */   U_V:  /* U > V, i.e., (lu > lv) || (lu == lv && u[lu-1] > v[lv-1]) */
   for ( i = 0; i < lv; i++ ) if ( u[i] != v[i] ) break;    for ( i = 0; i < lv; i++ ) if ( u[i] != v[i] ) break;
   if ( i != 0 ) u += i, lu -= i,  v += i, lv -= i;    if ( i != 0 ) u += i, lu -= i,  v += i, lv -= i;
   if ( lv == 0 ) {      /* no more pv[], and lu > 0 */    if ( lv == 0 ) {  /* no more pv[], and lu > 0 */
     i = trailingzeros_nbd( u, &rsh );      i = trailingzeros_nbd( u, &rsh );
     i = rshift_nbd( u, lu, rsh, i, a );      i = rshift_nbd( u, lu, rsh, i, a );
     return SIGNED_VAL( i, sign );      return SIGNED_VAL( i, sign );
Line 152  int *u, lu, *v, lv, *a;
Line 152  int *u, lu, *v, lv, *a;
     if ( i >= lu ) /* lu == lv, and b==0 is implied */ goto chk_nz;      if ( i >= lu ) /* lu == lv, and b==0 is implied */ goto chk_nz;
     /* we still have (lu-i) elms in U */      /* we still have (lu-i) elms in U */
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
     if ( b != 0 ) {     /* non-zero borrow */      if ( b != 0 ) {  /* non-zero borrow */
       if ( (w = u[i++] -1) != 0 ) t |= (w << lsh);        if ( (w = u[i++] -1) != 0 ) t |= (w << lsh);
       if ( i >= lu ) {  /* lu == lv+1.  The M.S. word w may become 0 */        if ( i >= lu ) {  /* lu == lv+1.  The M.S. word w may become 0 */
         if ( w != 0 ) {    if ( w != 0 ) {
           *p++ = t;      *p++ = t;
           l = lv;      l = lv;
           t = w >> rsh;      t = w >> rsh;
         } else lu--;    } else lu--;
         goto chk_nz;    goto chk_nz;
       }        }
       /**/        /**/
       *p++ = t;        *p++ = t;
       if ( w == BMask ) {        if ( w == BMask ) {
         while ( (w = u[i++]) == 0 ) *p++ = BMask;    while ( (w = u[i++]) == 0 ) *p++ = BMask;
         w -= 1;    w -= 1;
         *p++ = (BMask >> rsh) | (w << lsh);    *p++ = (BMask >> rsh) | (w << lsh);
       }        }
       t = w >> rsh;        t = w >> rsh;
     }      }
     for ( ; i < lu; i++, t = w >> rsh ) *p++ = t | ((w = u[i]) << lsh);      for ( ; i < lu; i++, t = w >> rsh ) *p++ = t | ((w = u[i]) << lsh);
 #else  #else
     if ( b != 0 ) {     /* non-zero borrow */      if ( b != 0 ) {  /* non-zero borrow */
       if ( (w = u[i++] -1) != 0 ) t |= ((w << lsh) & BMASK);        if ( (w = u[i++] -1) != 0 ) t |= ((w << lsh) & BMASK);
       if ( i >= lu ) {  /* lu == lv+1.  The M.S. word w may become 0 */        if ( i >= lu ) {  /* lu == lv+1.  The M.S. word w may become 0 */
         if ( w != 0 ) {    if ( w != 0 ) {
           *p++ = t;      *p++ = t;
           l = lv;      l = lv;
           t = w >> rsh;      t = w >> rsh;
         } else lu--;    } else lu--;
         goto chk_nz;    goto chk_nz;
       }        }
       *p++ = t;        *p++ = t;
       if ( w < 0 ) {        if ( w < 0 ) {
         while ( (w = u[i++]) == 0 ) *p++ = BMASK;    while ( (w = u[i++]) == 0 ) *p++ = BMASK;
         w -= 1;    w -= 1;
         *p++ = (BMASK >> rsh) | ((w << lsh) & BMASK);    *p++ = (BMASK >> rsh) | ((w << lsh) & BMASK);
       }        }
       t = w >> rsh;        t = w >> rsh;
     }      }
Line 214  int *u, lu, *v, lv, *a;
Line 214  int *u, lu, *v, lv, *a;
 #endif  #endif
   }    }
   if ( i >= lu ) /* lu == lv, and b==0 is implied */ goto ret_nz;    if ( i >= lu ) /* lu == lv, and b==0 is implied */ goto ret_nz;
   if ( b != 0 ) {       /* non-zero borrow */    if ( b != 0 ) {  /* non-zero borrow */
     t = u[i++] -1;      t = u[i++] -1;
     if ( i >= lu ) /* lu == lv+1.  The M.S. word w may beome 0 */ goto chk_nz;      if ( i >= lu ) /* lu == lv+1.  The M.S. word w may beome 0 */ goto chk_nz;
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
Line 222  int *u, lu, *v, lv, *a;
Line 222  int *u, lu, *v, lv, *a;
       do *p++ = BMask; while ( (t = u[i++]) == 0 );        do *p++ = BMask; while ( (t = u[i++]) == 0 );
       t -= 1;        t -= 1;
       if ( i >= lu ) {        if ( i >= lu ) {
         l = lu;    l = lu;
         if ( t == 0 ) l--;    if ( t == 0 ) l--;
         else *p = t;    else *p = t;
         goto ret_nz;    goto ret_nz;
       }        }
     }      }
 #else  #else
Line 233  int *u, lu, *v, lv, *a;
Line 233  int *u, lu, *v, lv, *a;
       do *p++ = BMASK; while ( (t = u[i++]) == 0 );        do *p++ = BMASK; while ( (t = u[i++]) == 0 );
       t -= 1;        t -= 1;
       if ( i >= lu ) {        if ( i >= lu ) {
         l = lu;    l = lu;
         if ( t == 0 ) l--;    if ( t == 0 ) l--;
         else *p = t;    else *p = t;
         goto ret_nz;    goto ret_nz;
       }        }
     }      }
 #endif  #endif
Line 285  int *u, lu, a, *v, lv, *ans;
Line 285  int *u, lu, a, *v, lv, *ans;
       if ( w < t ) c++;        if ( w < t ) c++;
       t = w - t;        t = w - t;
 #else  #else
       t = w - t;            /* We shall compute U - a*V */        t = w - t;      /* We shall compute U - a*V */
       if ( t < 0 ) t += BASE, c++;        if ( t < 0 ) t += BASE, c++;
 #endif  #endif
     } else { /* a*V > U if lv>lu, and very likely even if lv==lu */      } else { /* a*V > U if lv>lu, and very likely even if lv==lu */
       b = 0;        b = 0;
       if ( t >= w ) t -= w;        if ( t >= w ) t -= w;
       else {        else {
         t -= w;    t -= w;
 #if BSH != BIT_WIDTH_OF_INT  #if BSH != BIT_WIDTH_OF_INT
         t += BASE;    t += BASE;
 #endif  #endif
         if ( c != 0 ) c--;    if ( c != 0 ) c--;
         else b = 1;    else b = 1;
       }        }
     }      }
     TRAILINGZEROS( t, rsh );      TRAILINGZEROS( t, rsh );
     return( lv < lu ? ( rsh == 0 ? abs_U_aV_c( t, u, lu, a, v, lv, c, ans ) :      return( lv < lu ? ( rsh == 0 ? abs_U_aV_c( t, u, lu, a, v, lv, c, ans ) :
                         abs_U_aV_c_sh( t, u, lu, a, v, lv, c, rsh, ans ) ) :              abs_U_aV_c_sh( t, u, lu, a, v, lv, c, rsh, ans ) ) :
             rsh == 0 ? abs_aVplusc_U( t, a, v, lv, c, b, u, lu, ans ) :        rsh == 0 ? abs_aVplusc_U( t, a, v, lv, c, b, u, lu, ans ) :
             abs_aVplusc_U_sh( t, a, v, lv, c, b, u, lu, rsh, ans ) );        abs_aVplusc_U_sh( t, a, v, lv, c, b, u, lu, rsh, ans ) );
   }    }
   /**/    /**/
   if ( i < lv ) {  /* no more u[] elm.'s, and we still have non-zero v[] elm's */    if ( i < lv ) {  /* no more u[] elm.'s, and we still have non-zero v[] elm's */
Line 323  int *u, lu, a, *v, lv, *ans;
Line 323  int *u, lu, a, *v, lv, *ans;
     i = 0;      i = 0;
     if ( rsh == 0 ) {      if ( rsh == 0 ) {
       *p++ = t;        *p++ = t;
       for ( ; i < lv; i++, c = hi, *p++ = t ) { DMA( a, v[i], c, hi, t ); }        for ( ; i < lv; i++, c = hi, *p++ = t ) {  DMA( a, v[i], c, hi, t ); }
       if ( c == 0 ) return( i + 1 );        if ( c == 0 ) return( i + 1 );
       *p = c;        *p = c;
       return( i + 2 );        return( i + 2 );
     } else {      } else {
       for ( lsh = BSH - rsh; i < lv; i++, c = hi, t = w >> rsh ) {        for ( lsh = BSH - rsh; i < lv; i++, c = hi, t = w >> rsh ) {
         DMA( a, v[i], c, hi, w );    DMA( a, v[i], c, hi, w );
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
         *p++ = t | (w << lsh);    *p++ = t | (w << lsh);
 #else  #else
         *p++ = t | ((w << lsh) & BMASK);    *p++ = t | ((w << lsh) & BMASK);
 #endif  #endif
       }        }
       if ( c != 0 ) {        if ( c != 0 ) {
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
         *p++ = t | (c << lsh);    *p++ = t | (c << lsh);
 #else  #else
         *p++ = t | ((c << lsh) & BMASK);    *p++ = t | ((c << lsh) & BMASK);
 #endif  #endif
         i++;    i++;
         t = c >> rsh;    t = c >> rsh;
       }        }
       if ( t == 0 ) return i;        if ( t == 0 ) return i;
       *p = t;        *p = t;
Line 393  int *u, lu, a, *v, lv, *ans;
Line 393  int *u, lu, a, *v, lv, *ans;
     if ( c != 0 ) {  /* there still exists u[] elms.'s because diff is known to be > 0 */      if ( c != 0 ) {  /* there still exists u[] elms.'s because diff is known to be > 0 */
       if ( (w = u[i++]) == 0 ) {        if ( (w = u[i++]) == 0 ) {
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
         *p++ = t | (BMask << lsh);    *p++ = t | (BMask << lsh);
 #else  #else
         *p++ = t | ((BMASK << lsh) & BMASK);    *p++ = t | ((BMASK << lsh) & BMASK);
 #endif  #endif
         for ( ; (w = u[i++]) == 0; *p++ = BMASK ) ;    for ( ; (w = u[i++]) == 0; *p++ = BMASK ) ;
         t = BMASK >> rsh;    t = BMASK >> rsh;
       }        }
       w--;        w--;
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
Line 512  int t, a, *v, lv, c, b, *u, lu, *ans;
Line 512  int t, a, *v, lv, c, b, *u, lu, *ans;
 #else  #else
       if ( i == 0 ) { ans[i] = BASE - t; return 1; }        if ( i == 0 ) { ans[i] = BASE - t; return 1; }
 #endif  #endif
       l = negate_nbd( ans, i );         /* <================ */        l = negate_nbd( ans, i );    /* <================ */
 /*    if ( (t = BMASK ^ ans[i]) == 0 ) return l;*/  /*    if ( (t = BMASK ^ ans[i]) == 0 ) return l;*/
       if ( (t ^= BMASK) == 0 ) return l;        if ( (t ^= BMASK) == 0 ) return l;
       ans[i] = t;        ans[i] = t;
Line 580  int t, a, *v, lv, c, b, *u, lu, rsh, *ans;
Line 580  int t, a, *v, lv, c, b, *u, lu, rsh, *ans;
     if ( b != 0 ) {  /* diff turned out to be < 0 */      if ( b != 0 ) {  /* diff turned out to be < 0 */
       if ( i == 0 ) {        if ( i == 0 ) {
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
         *p = (1 << lsh) - t;    *p = (1 << lsh) - t;
 #else  #else
         *p = (BASE >> rsh) - t;    *p = (BASE >> rsh) - t;
 #endif  #endif
         return 1;    return 1;
       }        }
       l = negate_nbd( ans, i );         /* <================ */        l = negate_nbd( ans, i );    /* <================ */
       if ( (t ^= (BMASK >> rsh)) == 0 ) return l;        if ( (t ^= (BMASK >> rsh)) == 0 ) return l;
       *p = t;        *p = t;
       return( i + 1 );        return( i + 1 );
Line 661  unsigned
Line 661  unsigned
 #endif  #endif
 int t, *u, lu, a, *v, lv, c, *ans;  int t, *u, lu, a, *v, lv, c, *ans;
     /*  compute | t + BASE*(U - a*V - c) | in ans[], where U = u[0:lu-1], V = v[0:lv-1],      /*  compute | t + BASE*(U - a*V - c) | in ans[], where U = u[0:lu-1], V = v[0:lv-1],
      *  c is <= BASE-1, and lu >= lv+1 && t != 0 assumed.       *  c is <= BASE-1, and lu >= lv+1 && t != 0 assumed.
      */       */
 {  {
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
Line 694  int t, *u, lu, a, *v, lv, c, *ans;
Line 694  int t, *u, lu, a, *v, lv, c, *ans;
     t = u[i] - b;      t = u[i] - b;
     if ( t == c ) return l;      if ( t == c ) return l;
     else if ( t > c ) { *p = t - c; return( lu + 1 ); }      else if ( t > c ) { *p = t - c; return( lu + 1 ); }
     l = negate_nbd( ans, lu );          /* <================ */      l = negate_nbd( ans, lu );    /* <================ */
     if ( (c -= (t + 1)) == 0 ) return l;      if ( (c -= (t + 1)) == 0 ) return l;
     *p = c;      *p = c;
     return( lu + 1 );      return( lu + 1 );
Line 705  int t, *u, lu, a, *v, lv, c, *ans;
Line 705  int t, *u, lu, a, *v, lv, c, *ans;
        of the case when lu == lv+2 && u[lu-2:lu-1]=u[i:i+1] == BASE  */         of the case when lu == lv+2 && u[lu-2:lu-1]=u[i:i+1] == BASE  */
     if ( /* c == BMASK && */ b != 0 ) {      if ( /* c == BMASK && */ b != 0 ) {
       if ( i+2 == lu && u[i+1] == 1 ) {        if ( i+2 == lu && u[i+1] == 1 ) {
         /* m.s. word of the diff becomes 0 */    /* m.s. word of the diff becomes 0 */
         if ( (t = u[i]) == 0 ) return l;    if ( (t = u[i]) == 0 ) return l;
         *p = t;    *p = t;
         return lu;    return lu;
       }        }
       *p++ = u[i++];        *p++ = u[i++];
       c = 1;        c = 1;
Line 784  int t, *u, lu, a, *v, lv, c, rsh, *ans;
Line 784  int t, *u, lu, a, *v, lv, c, rsh, *ans;
     }      }
     /* diff turned out to be < 0 */      /* diff turned out to be < 0 */
     w = c - x - 1;      w = c - x - 1;
     if ( lv == 0 ) {    /* lu == 1 */      if ( lv == 0 ) {  /* lu == 1 */
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
       t = (1 << lsh) - t;        t = (1 << lsh) - t;
 #else  #else
Line 794  int t, *u, lu, a, *v, lv, c, rsh, *ans;
Line 794  int t, *u, lu, a, *v, lv, c, rsh, *ans;
       *p = t;        *p = t;
       return 1;        return 1;
     }      }
     l = negate_nbd( ans, lv );          /* <================ */      l = negate_nbd( ans, lv );    /* <================ */
     t ^= (BMASK >> rsh);      t ^= (BMASK >> rsh);
     if ( w != 0 ) goto l0;      if ( w != 0 ) goto l0;
     if ( t == 0 ) return l;      if ( t == 0 ) return l;
Line 807  int t, *u, lu, a, *v, lv, c, rsh, *ans;
Line 807  int t, *u, lu, a, *v, lv, c, rsh, *ans;
        of the case when lu == lv+2 && u[lu-2:lu-1]=u[i:i+1] == BASE  */         of the case when lu == lv+2 && u[lu-2:lu-1]=u[i:i+1] == BASE  */
     if ( /* c == BMASK && */ b != 0 ) {      if ( /* c == BMASK && */ b != 0 ) {
       if ( i+2 == lu && u[i+1] == 1 && t == 0 && u[i] == 0 )        if ( i+2 == lu && u[i+1] == 1 && t == 0 && u[i] == 0 )
         return l; /* m.s. word of the diff has become 0 */    return l; /* m.s. word of the diff has become 0 */
       w = u[i++];        w = u[i++];
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
       *p++ = t | (w << lsh);        *p++ = t | (w << lsh);
Line 834  int t, *u, lu, a, *v, lv, c, rsh, *ans;
Line 834  int t, *u, lu, a, *v, lv, c, rsh, *ans;
     w >>= rsh;      w >>= rsh;
     if ( i >= lu ) {      if ( i >= lu ) {
       if ( w != 0 ) {        if ( w != 0 ) {
         *p++ = t;    *p++ = t;
         *p = w;    *p = w;
         return( lu + 1 );    return( lu + 1 );
       } else if ( t == 0 ) return( i - 1 );        } else if ( t == 0 ) return( i - 1 );
       else { *p = t; return i; }        else { *p = t; return i; }
     }      }
Line 966  int a, *u, lu, b, *v, lv, *ans;
Line 966  int a, *u, lu, b, *v, lv, *ans;
       if ( t == s ) continue;        if ( t == s ) continue;
       else if ( t > s ) t -= s;        else if ( t > s ) t -= s;
       else {        else {
         t -= s;    t -= s;
 #if BSH != BIT_WIDTH_OF_INT  #if BSH != BIT_WIDTH_OF_INT
         t += BASE;    t += BASE;
 #endif  #endif
         if ( c != 0 ) c--;    if ( c != 0 ) c--;
         else d++;    else d++;
       }        }
       l = i;        l = i;
     }      }
Line 981  int a, *u, lu, b, *v, lv, *ans;
Line 981  int a, *u, lu, b, *v, lv, *ans;
       if ( c == d ) return( l + 1 );        if ( c == d ) return( l + 1 );
       else if ( c > d ) c -= d;        else if ( c > d ) c -= d;
       else {        else {
         l = negate_nbd( ans, i + 1 );           /* <================ */    l = negate_nbd( ans, i + 1 );    /* <================ */
         if ( (c = d-c - 1) == 0 ) return l;    if ( (c = d-c - 1) == 0 ) return l;
       }        }
       *p = c;        *p = c;
       return( i + 2 );        return( i + 2 );
Line 992  int a, *u, lu, b, *v, lv, *ans;
Line 992  int a, *u, lu, b, *v, lv, *ans;
     else {      else {
       DMA( a, u[i], c, hi, t );        DMA( a, u[i], c, hi, t );
       if ( i+1 >= lu ) {        if ( i+1 >= lu ) {
         if ( hi == 0 ) { c = t; goto final_c_d; }    if ( hi == 0 ) { c = t; goto final_c_d; }
         c = hi;    c = hi;
         if ( t >= d ) t -= d;    if ( t >= d ) t -= d;
         else {    else {
           t -= d;      t -= d;
 #if BSH != BIT_WIDTH_OF_INT  #if BSH != BIT_WIDTH_OF_INT
           t += BASE;      t += BASE;
 #endif  #endif
           c--;      c--;
         }    }
         i++, *p++ = t;    i++, *p++ = t;
         goto final_c;    goto final_c;
       }        }
       i++, c = hi;        i++, c = hi;
       if ( t >= d ) *p++ = t - d;        if ( t >= d ) *p++ = t - d;
       else {        else {
         t -= d;    t -= d;
 #if BSH != BIT_WIDTH_OF_INT  #if BSH != BIT_WIDTH_OF_INT
         t += BASE;    t += BASE;
 #endif  #endif
         *p++ = t;    *p++ = t;
         if ( c != 0 ) c--;    if ( c != 0 ) c--;
         else {    else {
           for ( ; i < lu; *p++ = BMASK ) {      for ( ; i < lu; *p++ = BMASK ) {
             DMA( a, u[i], c, hi, t );        DMA( a, u[i], c, hi, t );
             i++, c = hi;        i++, c = hi;
             if ( t == 0 ) continue;        if ( t == 0 ) continue;
             *p++ = t - 1;        *p++ = t - 1;
             goto aU;        goto aU;
           }      }
           c--;      c--;
           goto final_c;      goto final_c;
         }    }
       }        }
     }      }
     /*** return( aV_plus_c( a, &u[i], lu - i, c, p ) + i + 1 ); ***/      /*** return( aV_plus_c( a, &u[i], lu - i, c, p ) + i + 1 ); ***/
Line 1041  int a, *u, lu, b, *v, lv, *ans;
Line 1041  int a, *u, lu, b, *v, lv, *ans;
       i++;        i++;
       if ( w >= s ) w -= s;        if ( w >= s ) w -= s;
       else {        else {
         w -= s;    w -= s;
 #if BSH != BIT_WIDTH_OF_INT  #if BSH != BIT_WIDTH_OF_INT
         w += BASE;    w += BASE;
 #endif  #endif
         if ( c != 0 ) c--;    if ( c != 0 ) c--;
         else d++;    else d++;
       }        }
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
       if ( (*p++ = t | (w << lsh)) != 0 ) l = i;        if ( (*p++ = t | (w << lsh)) != 0 ) l = i;
Line 1058  int a, *u, lu, b, *v, lv, *ans;
Line 1058  int a, *u, lu, b, *v, lv, *ans;
     if ( i >= lu ) {      if ( i >= lu ) {
     final_c_d_sh:      final_c_d_sh:
       if ( c == d )        if ( c == d )
         if ( t == 0 ) return l;    if ( t == 0 ) return l;
         else { *p = t; return( i + 1 ); }    else { *p = t; return( i + 1 ); }
       else if ( c > d ) c -= d;        else if ( c > d ) c -= d;
       else {        else {
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
         if ( i == 0 ) t = (1 << lsh) - t;    if ( i == 0 ) t = (1 << lsh) - t;
 #else  #else
         if ( i == 0 ) t = (BASE >> rsh) - t;    if ( i == 0 ) t = (BASE >> rsh) - t;
 #endif  #endif
         else {    else {
           l = negate_nbd( ans, i );             /* <================ */      l = negate_nbd( ans, i );    /* <================ */
 /*        t = (BASE >> rsh) - t;*/  /*    t = (BASE >> rsh) - t;*/
           t ^= ((BMASK >> rsh));      t ^= ((BMASK >> rsh));
         }    }
         c = d-c -1;    c = d-c -1;
       }        }
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
       *p++ = t | (c << lsh);        *p++ = t | (c << lsh);
Line 1086  int a, *u, lu, b, *v, lv, *ans;
Line 1086  int a, *u, lu, b, *v, lv, *ans;
     else {      else {
       DMA( a, u[i], c, hi, w );        DMA( a, u[i], c, hi, w );
       if ( i+1 >= lu ) {        if ( i+1 >= lu ) {
         if ( hi == 0 ) { c = w; goto final_c_d_sh; }    if ( hi == 0 ) { c = w; goto final_c_d_sh; }
         c = hi;    c = hi;
         if ( w >= d ) w -= d;    if ( w >= d ) w -= d;
         else {    else {
           w -= d;      w -= d;
 #if BSH != BIT_WIDTH_OF_INT  #if BSH != BIT_WIDTH_OF_INT
           w += BASE;      w += BASE;
 #endif  #endif
           c--;      c--;
         }    }
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
         i++, *p++ = t | (w << lsh);    i++, *p++ = t | (w << lsh);
 #else  #else
         i++, *p++ = t | ((w << lsh) & BMASK);    i++, *p++ = t | ((w << lsh) & BMASK);
 #endif  #endif
         t = w >> rsh;    t = w >> rsh;
         goto final_c_sh;    goto final_c_sh;
       }        }
       i++, c = hi;        i++, c = hi;
       if ( w >= d ) {        if ( w >= d ) {
         w -= d;    w -= d;
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
         *p++ = t | (w << lsh);    *p++ = t | (w << lsh);
 #else  #else
         *p++ = t | ((w << lsh) & BMASK);    *p++ = t | ((w << lsh) & BMASK);
 #endif  #endif
         t = w >> rsh;    t = w >> rsh;
       } else {        } else {
         w -= d;    w -= d;
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
         *p++ = t | (w << lsh);    *p++ = t | (w << lsh);
 #else  #else
         w += BASE;    w += BASE;
         *p++ = t | ((w << lsh) & BMASK);    *p++ = t | ((w << lsh) & BMASK);
 #endif  #endif
         t = w >> rsh;    t = w >> rsh;
         if ( c != 0 ) c--;    if ( c != 0 ) c--;
         else {    else {
           while ( i < lu ) {      while ( i < lu ) {
             DMA( a, u[i], c, hi, w );        DMA( a, u[i], c, hi, w );
             c = hi;        c = hi;
             i++;        i++;
             if ( w == 0 ) {        if ( w == 0 ) {
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
               *p++ = t | (BMASK << lsh);          *p++ = t | (BMASK << lsh);
               t = BMASK >> rsh;          t = BMASK >> rsh;
 #else  #else
               *p++ = t | ((BMASK << lsh) & BMASK);          *p++ = t | ((BMASK << lsh) & BMASK);
               t = BMASK >> rsh;          t = BMASK >> rsh;
 #endif  #endif
               continue;          continue;
             } else {        } else {
               w--;          w--;
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
               *p++ = t | (w << lsh);          *p++ = t | (w << lsh);
 #else  #else
               *p++ = t | ((w << lsh) & BMASK);          *p++ = t | ((w << lsh) & BMASK);
 #endif  #endif
               t = w >> rsh;          t = w >> rsh;
               goto aU_sh;          goto aU_sh;
             }  
           }  
           c--;  
           goto final_c_sh;  
         }  
       }        }
     }      }
       c--;
       goto final_c_sh;
     }
         }
       }
     /*** return( aV_plus_c_sh( a, &u[i], lu - i, c, rsh, t ) + i ); ***/      /*** return( aV_plus_c_sh( a, &u[i], lu - i, c, rsh, t ) + i ); ***/
   aU_sh:    aU_sh:
     for ( ; i < lu; i++, c = hi, t = w >> rsh ) {      for ( ; i < lu; i++, c = hi, t = w >> rsh ) {
Line 1314  u_rest:
Line 1314  u_rest:
 #if BSH == BIT_WIDTH_OF_INT  #if BSH == BIT_WIDTH_OF_INT
     if ( c < d ) {      if ( c < d ) {
       if ( i >= lu ) {        if ( i >= lu ) {
         *p++ = t | (c << lsh);    *p++ = t | (c << lsh);
         *p = (c >> rsh) | (1 << lsh);    *p = (c >> rsh) | (1 << lsh);
         return( lu + 2 );    return( lu + 2 );
       }        }
       DMA( a, u[i], c, hi, w );        DMA( a, u[i], c, hi, w );
       c = hi + 1;        c = hi + 1;

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>