Import Tcl-code 8.6.8
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/* single digit addition */
|
||||
@@ -37,9 +37,8 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c)
|
||||
/* c = |a| - b */
|
||||
res = mp_sub_d(a, b, c);
|
||||
|
||||
/* fix signs */
|
||||
a->sign = MP_NEG;
|
||||
c->sign = (c->used) ? MP_NEG : MP_ZPOS;
|
||||
/* fix sign */
|
||||
a->sign = c->sign = MP_NEG;
|
||||
|
||||
/* clamp */
|
||||
mp_clamp(c);
|
||||
@@ -107,3 +106,7 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision: 0.41 $ */
|
||||
/* $Date: 2007-04-18 09:58:18 +0000 $ */
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/* returns size of ASCII reprensentation */
|
||||
@@ -66,18 +66,13 @@ int mp_radix_size (mp_int * a, int radix, int *size)
|
||||
}
|
||||
mp_clear (&t);
|
||||
|
||||
/*
|
||||
* return digs + 1, the 1 is for the NULL byte that would be required.
|
||||
* mp_toradix_n requires a minimum of 3 bytes, so never report less than
|
||||
* that.
|
||||
*/
|
||||
|
||||
if ( digs >= 2 ) {
|
||||
*size = digs + 1;
|
||||
} else {
|
||||
*size = 3;
|
||||
}
|
||||
/* return digs + 1, the 1 is for the NULL byte that would be required. */
|
||||
*size = digs + 1;
|
||||
return MP_OKAY;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision: 0.41 $ */
|
||||
/* $Date: 2007-04-18 09:58:18 +0000 $ */
|
||||
|
||||
@@ -276,7 +276,7 @@ int mp_mod_2d(const mp_int *a, int b, mp_int *c);
|
||||
int mp_2expt(mp_int *a, int b);
|
||||
|
||||
/* Counts the number of lsbs which are zero before the first zero bit */
|
||||
int mp_cnt_lsb(mp_int *a);
|
||||
int mp_cnt_lsb(const mp_int *a);
|
||||
|
||||
/* I Love Earth! */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user