Check-in [1af92e6c04]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:add tcl upstream changes
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1af92e6c04bbc93f471e0e351970b87d9c868ca0
User & Date: chw 2019-05-30 09:29:46
Context
2019-05-30
15:10
improve tcl-fuse w.r.t. [de97313b0b] check-in: acb4d8bdc9 user: chw tags: trunk
09:29
add tcl upstream changes check-in: 1af92e6c04 user: chw tags: trunk
09:17
add search function from ticket [0083572bf6] check-in: 3b1d6ac35e user: chw tags: trunk
Changes

Changes to jni/tcl/generic/tclExecute.c.

  8655   8655   	    Tcl_TakeBignumFromObj(NULL, valuePtr, &big1);
  8656   8656   	    Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
  8657   8657   
  8658   8658   	    mp_init(&bigResult);
  8659   8659   
  8660   8660   	    switch (opcode) {
  8661   8661   	    case INST_BITAND:
  8662         -		mp_tc_and(&big1, &big2, &bigResult);
         8662  +		mp_and(&big1, &big2, &bigResult);
  8663   8663   		break;
  8664   8664   
  8665   8665   	    case INST_BITOR:
  8666         -		mp_tc_or(&big1, &big2, &bigResult);
         8666  +		mp_or(&big1, &big2, &bigResult);
  8667   8667   		break;
  8668   8668   
  8669   8669   	    case INST_BITXOR:
  8670         -		mp_tc_xor(&big1, &big2, &bigResult);
         8670  +		mp_xor(&big1, &big2, &bigResult);
  8671   8671   		break;
  8672   8672   	    }
  8673   8673   
  8674   8674   	    mp_clear(&big1);
  8675   8675   	    mp_clear(&big2);
  8676   8676   	    BIG_RESULT(&bigResult);
  8677   8677   	}

Changes to jni/tcl/generic/tclStringObj.c.

  2040   2040   	    } else if (useWide) {
  2041   2041   		if (Tcl_GetWideIntFromObj(NULL, segment, &w) != TCL_OK) {
  2042   2042   		    Tcl_Obj *objPtr;
  2043   2043   
  2044   2044   		    if (Tcl_GetBignumFromObj(interp,segment,&big) != TCL_OK) {
  2045   2045   			goto error;
  2046   2046   		    }
  2047         -		    mp_mod_2d(&big, (int) CHAR_BIT*sizeof(Tcl_WideInt), &big);
         2047  +		    mp_mod_2d(&big, CHAR_BIT*sizeof(Tcl_WideInt), &big);
  2048   2048   		    objPtr = Tcl_NewBignumObj(&big);
  2049   2049   		    Tcl_IncrRefCount(objPtr);
  2050   2050   		    Tcl_GetWideIntFromObj(NULL, objPtr, &w);
  2051   2051   		    Tcl_DecrRefCount(objPtr);
  2052   2052   		}
  2053   2053   		isNegative = (w < (Tcl_WideInt) 0);
  2054   2054   #endif
................................................................................
  2055   2055   	    } else if (TclGetLongFromObj(NULL, segment, &l) != TCL_OK) {
  2056   2056   		if (Tcl_GetWideIntFromObj(NULL, segment, &w) != TCL_OK) {
  2057   2057   		    Tcl_Obj *objPtr;
  2058   2058   
  2059   2059   		    if (Tcl_GetBignumFromObj(interp,segment,&big) != TCL_OK) {
  2060   2060   			goto error;
  2061   2061   		    }
  2062         -		    mp_mod_2d(&big, (int) CHAR_BIT * sizeof(long), &big);
         2062  +		    mp_mod_2d(&big, CHAR_BIT * sizeof(long), &big);
  2063   2063   		    objPtr = Tcl_NewBignumObj(&big);
  2064   2064   		    Tcl_IncrRefCount(objPtr);
  2065   2065   		    TclGetLongFromObj(NULL, objPtr, &l);
  2066   2066   		    Tcl_DecrRefCount(objPtr);
  2067   2067   		} else {
  2068   2068   		    l = Tcl_WideAsLong(w);
  2069   2069   		}

jni/tcl/library/msgs/ja.msg became a regular file.


Changes to jni/tcl/libtommath/bn_mp_and.c.

     1      1   #include "tommath_private.h"
     2      2   #ifdef BN_MP_AND_C
     3         -/* LibTomMath, multiple-precision integer library -- Tom St Denis
     4         - *
     5         - * LibTomMath is a library that provides multiple-precision
     6         - * integer arithmetic as well as number theoretic functionality.
     7         - *
     8         - * The library was designed directly after the MPI library by
     9         - * Michael Fromberger but has been written from scratch with
    10         - * additional optimizations in place.
    11         - *
    12         - * SPDX-License-Identifier: Unlicense
    13         - */
            3  +/* LibTomMath, multiple-precision integer library -- Tom St Denis */
            4  +/* SPDX-License-Identifier: Unlicense */
    14      5   
    15         -/* AND two ints together */
    16         -int mp_and(const mp_int *a, const mp_int *b, mp_int *c)
            6  +/* two complement and */
            7  +mp_err mp_and(const mp_int *a, const mp_int *b, mp_int *c)
    17      8   {
    18         -   int     res, ix, px;
    19         -   mp_int  t;
    20         -   const mp_int *x;
            9  +   int used = MAX(a->used, b->used) + 1, i;
           10  +   mp_err err;
           11  +   mp_digit ac = 1, bc = 1, cc = 1;
           12  +   mp_sign csign = ((a->sign == MP_NEG) && (b->sign == MP_NEG)) ? MP_NEG : MP_ZPOS;
           13  +
           14  +   if (c->alloc < used) {
           15  +      if ((err = mp_grow(c, used)) != MP_OKAY) {
           16  +         return err;
           17  +      }
           18  +   }
           19  +
           20  +   for (i = 0; i < used; i++) {
           21  +      mp_digit x, y;
    21     22   
    22         -   if (a->used > b->used) {
    23         -      if ((res = mp_init_copy(&t, a)) != MP_OKAY) {
    24         -         return res;
           23  +      /* convert to two complement if negative */
           24  +      if (a->sign == MP_NEG) {
           25  +         ac += (i >= a->used) ? MP_MASK : (~a->dp[i] & MP_MASK);
           26  +         x = ac & MP_MASK;
           27  +         ac >>= MP_DIGIT_BIT;
           28  +      } else {
           29  +         x = (i >= a->used) ? 0uL : a->dp[i];
    25     30         }
    26         -      px = b->used;
    27         -      x = b;
    28         -   } else {
    29         -      if ((res = mp_init_copy(&t, b)) != MP_OKAY) {
    30         -         return res;
           31  +
           32  +      /* convert to two complement if negative */
           33  +      if (b->sign == MP_NEG) {
           34  +         bc += (i >= b->used) ? MP_MASK : (~b->dp[i] & MP_MASK);
           35  +         y = bc & MP_MASK;
           36  +         bc >>= MP_DIGIT_BIT;
           37  +      } else {
           38  +         y = (i >= b->used) ? 0uL : b->dp[i];
    31     39         }
    32         -      px = a->used;
    33         -      x = a;
           40  +
           41  +      c->dp[i] = x & y;
           42  +
           43  +      /* convert to to sign-magnitude if negative */
           44  +      if (csign == MP_NEG) {
           45  +         cc += ~c->dp[i] & MP_MASK;
           46  +         c->dp[i] = cc & MP_MASK;
           47  +         cc >>= MP_DIGIT_BIT;
           48  +      }
    34     49      }
    35     50   
    36         -   for (ix = 0; ix < px; ix++) {
    37         -      t.dp[ix] &= x->dp[ix];
    38         -   }
    39         -
    40         -   /* zero digits above the last from the smallest mp_int */
    41         -   for (; ix < t.used; ix++) {
    42         -      t.dp[ix] = 0;
    43         -   }
    44         -
    45         -   mp_clamp(&t);
    46         -   mp_exch(c, &t);
    47         -   mp_clear(&t);
           51  +   c->used = used;
           52  +   c->sign = csign;
           53  +   mp_clamp(c);
    48     54      return MP_OKAY;
    49     55   }
    50     56   #endif
    51         -
    52         -/* ref:         $Format:%D$ */
    53         -/* git commit:  $Format:%H$ */
    54         -/* commit time: $Format:%ai$ */

Changes to jni/tcl/libtommath/bn_mp_cmp.c.

     1      1   #include "tommath_private.h"
     2      2   #ifdef BN_MP_CMP_C
     3         -/* LibTomMath, multiple-precision integer library -- Tom St Denis
     4         - *
     5         - * LibTomMath is a library that provides multiple-precision
     6         - * integer arithmetic as well as number theoretic functionality.
     7         - *
     8         - * The library was designed directly after the MPI library by
     9         - * Michael Fromberger but has been written from scratch with
    10         - * additional optimizations in place.
    11         - *
    12         - * SPDX-License-Identifier: Unlicense
    13         - */
            3  +/* LibTomMath, multiple-precision integer library -- Tom St Denis */
            4  +/* SPDX-License-Identifier: Unlicense */
    14      5   
    15      6   /* compare two ints (signed)*/
    16         -int mp_cmp(const mp_int *a, const mp_int *b)
            7  +mp_ord mp_cmp(const mp_int *a, const mp_int *b)
    17      8   {
    18      9      /* compare based on sign */
    19     10      if (a->sign != b->sign) {
    20     11         if (a->sign == MP_NEG) {
    21     12            return MP_LT;
    22     13         } else {
    23     14            return MP_GT;
................................................................................
    29     20         /* if negative compare opposite direction */
    30     21         return mp_cmp_mag(b, a);
    31     22      } else {
    32     23         return mp_cmp_mag(a, b);
    33     24      }
    34     25   }
    35     26   #endif
    36         -
    37         -/* ref:         $Format:%D$ */
    38         -/* git commit:  $Format:%H$ */
    39         -/* commit time: $Format:%ai$ */

Changes to jni/tcl/libtommath/bn_mp_cmp_d.c.

     1      1   #include "tommath_private.h"
     2      2   #ifdef BN_MP_CMP_D_C
     3         -/* LibTomMath, multiple-precision integer library -- Tom St Denis
     4         - *
     5         - * LibTomMath is a library that provides multiple-precision
     6         - * integer arithmetic as well as number theoretic functionality.
     7         - *
     8         - * The library was designed directly after the MPI library by
     9         - * Michael Fromberger but has been written from scratch with
    10         - * additional optimizations in place.
    11         - *
    12         - * SPDX-License-Identifier: Unlicense
    13         - */
            3  +/* LibTomMath, multiple-precision integer library -- Tom St Denis */
            4  +/* SPDX-License-Identifier: Unlicense */
    14      5   
    15      6   /* compare a digit */
    16         -int mp_cmp_d(const mp_int *a, mp_digit b)
            7  +mp_ord mp_cmp_d(const mp_int *a, mp_digit b)
    17      8   {
    18      9      /* compare based on sign */
    19     10      if (a->sign == MP_NEG) {
    20     11         return MP_LT;
    21     12      }
    22     13   
    23     14      /* compare based on magnitude */
................................................................................
    31     22      } else if (a->dp[0] < b) {
    32     23         return MP_LT;
    33     24      } else {
    34     25         return MP_EQ;
    35     26      }
    36     27   }
    37     28   #endif
    38         -
    39         -/* ref:         $Format:%D$ */
    40         -/* git commit:  $Format:%H$ */
    41         -/* commit time: $Format:%ai$ */

Changes to jni/tcl/libtommath/bn_mp_cmp_mag.c.

     1      1   #include "tommath_private.h"
     2      2   #ifdef BN_MP_CMP_MAG_C
     3         -/* LibTomMath, multiple-precision integer library -- Tom St Denis
     4         - *
     5         - * LibTomMath is a library that provides multiple-precision
     6         - * integer arithmetic as well as number theoretic functionality.
     7         - *
     8         - * The library was designed directly after the MPI library by
     9         - * Michael Fromberger but has been written from scratch with
    10         - * additional optimizations in place.
    11         - *
    12         - * SPDX-License-Identifier: Unlicense
    13         - */
            3  +/* LibTomMath, multiple-precision integer library -- Tom St Denis */
            4  +/* SPDX-License-Identifier: Unlicense */
    14      5   
    15      6   /* compare maginitude of two ints (unsigned) */
    16         -int mp_cmp_mag(const mp_int *a, const mp_int *b)
            7  +mp_ord mp_cmp_mag(const mp_int *a, const mp_int *b)
    17      8   {
    18      9      int     n;
    19         -   mp_digit *tmpa, *tmpb;
           10  +   const mp_digit *tmpa, *tmpb;
    20     11   
    21     12      /* compare based on # of non-zero digits */
    22     13      if (a->used > b->used) {
    23     14         return MP_GT;
    24     15      }
    25     16   
    26     17      if (a->used < b->used) {
................................................................................
    42     33         if (*tmpa < *tmpb) {
    43     34            return MP_LT;
    44     35         }
    45     36      }
    46     37      return MP_EQ;
    47     38   }
    48     39   #endif
    49         -
    50         -/* ref:         $Format:%D$ */
    51         -/* git commit:  $Format:%H$ */
    52         -/* commit time: $Format:%ai$ */

Changes to jni/tcl/libtommath/bn_mp_or.c.

     1      1   #include "tommath_private.h"
     2      2   #ifdef BN_MP_OR_C
     3         -/* LibTomMath, multiple-precision integer library -- Tom St Denis
     4         - *
     5         - * LibTomMath is a library that provides multiple-precision
     6         - * integer arithmetic as well as number theoretic functionality.
     7         - *
     8         - * The library was designed directly after the MPI library by
     9         - * Michael Fromberger but has been written from scratch with
    10         - * additional optimizations in place.
    11         - *
    12         - * SPDX-License-Identifier: Unlicense
    13         - */
            3  +/* LibTomMath, multiple-precision integer library -- Tom St Denis */
            4  +/* SPDX-License-Identifier: Unlicense */
    14      5   
    15         -/* OR two ints together */
    16         -int mp_or(const mp_int *a, const mp_int *b, mp_int *c)
            6  +/* two complement or */
            7  +mp_err mp_or(const mp_int *a, const mp_int *b, mp_int *c)
    17      8   {
    18         -   int     res, ix, px;
    19         -   mp_int  t;
    20         -   const mp_int *x;
            9  +   int used = MAX(a->used, b->used) + 1, i;
           10  +   mp_err err;
           11  +   mp_digit ac = 1, bc = 1, cc = 1;
           12  +   mp_sign csign = ((a->sign == MP_NEG) || (b->sign == MP_NEG)) ? MP_NEG : MP_ZPOS;
           13  +
           14  +   if (c->alloc < used) {
           15  +      if ((err = mp_grow(c, used)) != MP_OKAY) {
           16  +         return err;
           17  +      }
           18  +   }
           19  +
           20  +   for (i = 0; i < used; i++) {
           21  +      mp_digit x, y;
    21     22   
    22         -   if (a->used > b->used) {
    23         -      if ((res = mp_init_copy(&t, a)) != MP_OKAY) {
    24         -         return res;
           23  +      /* convert to two complement if negative */
           24  +      if (a->sign == MP_NEG) {
           25  +         ac += (i >= a->used) ? MP_MASK : (~a->dp[i] & MP_MASK);
           26  +         x = ac & MP_MASK;
           27  +         ac >>= MP_DIGIT_BIT;
           28  +      } else {
           29  +         x = (i >= a->used) ? 0uL : a->dp[i];
    25     30         }
    26         -      px = b->used;
    27         -      x = b;
    28         -   } else {
    29         -      if ((res = mp_init_copy(&t, b)) != MP_OKAY) {
    30         -         return res;
           31  +
           32  +      /* convert to two complement if negative */
           33  +      if (b->sign == MP_NEG) {
           34  +         bc += (i >= b->used) ? MP_MASK : (~b->dp[i] & MP_MASK);
           35  +         y = bc & MP_MASK;
           36  +         bc >>= MP_DIGIT_BIT;
           37  +      } else {
           38  +         y = (i >= b->used) ? 0uL : b->dp[i];
    31     39         }
    32         -      px = a->used;
    33         -      x = a;
           40  +
           41  +      c->dp[i] = x | y;
           42  +
           43  +      /* convert to to sign-magnitude if negative */
           44  +      if (csign == MP_NEG) {
           45  +         cc += ~c->dp[i] & MP_MASK;
           46  +         c->dp[i] = cc & MP_MASK;
           47  +         cc >>= MP_DIGIT_BIT;
           48  +      }
    34     49      }
    35     50   
    36         -   for (ix = 0; ix < px; ix++) {
    37         -      t.dp[ix] |= x->dp[ix];
    38         -   }
    39         -   mp_clamp(&t);
    40         -   mp_exch(c, &t);
    41         -   mp_clear(&t);
           51  +   c->used = used;
           52  +   c->sign = csign;
           53  +   mp_clamp(c);
    42     54      return MP_OKAY;
    43     55   }
    44     56   #endif
    45         -
    46         -/* ref:         $Format:%D$ */
    47         -/* git commit:  $Format:%H$ */
    48         -/* commit time: $Format:%ai$ */

Changes to jni/tcl/libtommath/bn_mp_xor.c.

     1      1   #include "tommath_private.h"
     2      2   #ifdef BN_MP_XOR_C
     3         -/* LibTomMath, multiple-precision integer library -- Tom St Denis
     4         - *
     5         - * LibTomMath is a library that provides multiple-precision
     6         - * integer arithmetic as well as number theoretic functionality.
     7         - *
     8         - * The library was designed directly after the MPI library by
     9         - * Michael Fromberger but has been written from scratch with
    10         - * additional optimizations in place.
    11         - *
    12         - * SPDX-License-Identifier: Unlicense
    13         - */
            3  +/* LibTomMath, multiple-precision integer library -- Tom St Denis */
            4  +/* SPDX-License-Identifier: Unlicense */
    14      5   
    15         -/* XOR two ints together */
    16         -int mp_xor(const mp_int *a, const mp_int *b, mp_int *c)
            6  +/* two complement xor */
            7  +mp_err mp_xor(const mp_int *a, const mp_int *b, mp_int *c)
    17      8   {
    18         -   int     res, ix, px;
    19         -   mp_int  t;
    20         -   const mp_int *x;
            9  +   int used = MAX(a->used, b->used) + 1, i;
           10  +   mp_err err;
           11  +   mp_digit ac = 1, bc = 1, cc = 1;
           12  +   mp_sign csign = (a->sign != b->sign) ? MP_NEG : MP_ZPOS;
           13  +
           14  +   if (c->alloc < used) {
           15  +      if ((err = mp_grow(c, used)) != MP_OKAY) {
           16  +         return err;
           17  +      }
           18  +   }
           19  +
           20  +   for (i = 0; i < used; i++) {
           21  +      mp_digit x, y;
    21     22   
    22         -   if (a->used > b->used) {
    23         -      if ((res = mp_init_copy(&t, a)) != MP_OKAY) {
    24         -         return res;
           23  +      /* convert to two complement if negative */
           24  +      if (a->sign == MP_NEG) {
           25  +         ac += (i >= a->used) ? MP_MASK : (~a->dp[i] & MP_MASK);
           26  +         x = ac & MP_MASK;
           27  +         ac >>= MP_DIGIT_BIT;
           28  +      } else {
           29  +         x = (i >= a->used) ? 0uL : a->dp[i];
    25     30         }
    26         -      px = b->used;
    27         -      x = b;
    28         -   } else {
    29         -      if ((res = mp_init_copy(&t, b)) != MP_OKAY) {
    30         -         return res;
           31  +
           32  +      /* convert to two complement if negative */
           33  +      if (b->sign == MP_NEG) {
           34  +         bc += (i >= b->used) ? MP_MASK : (~b->dp[i] & MP_MASK);
           35  +         y = bc & MP_MASK;
           36  +         bc >>= MP_DIGIT_BIT;
           37  +      } else {
           38  +         y = (i >= b->used) ? 0uL : b->dp[i];
    31     39         }
    32         -      px = a->used;
    33         -      x = a;
           40  +
           41  +      c->dp[i] = x ^ y;
           42  +
           43  +      /* convert to to sign-magnitude if negative */
           44  +      if (csign == MP_NEG) {
           45  +         cc += ~c->dp[i] & MP_MASK;
           46  +         c->dp[i] = cc & MP_MASK;
           47  +         cc >>= MP_DIGIT_BIT;
           48  +      }
    34     49      }
    35     50   
    36         -   for (ix = 0; ix < px; ix++) {
    37         -      t.dp[ix] ^= x->dp[ix];
    38         -   }
    39         -   mp_clamp(&t);
    40         -   mp_exch(c, &t);
    41         -   mp_clear(&t);
           51  +   c->used = used;
           52  +   c->sign = csign;
           53  +   mp_clamp(c);
    42     54      return MP_OKAY;
    43     55   }
    44     56   #endif
    45         -
    46         -/* ref:         $Format:%D$ */
    47         -/* git commit:  $Format:%H$ */
    48         -/* commit time: $Format:%ai$ */