comparison libtommath/bn_fast_s_mp_mul_high_digs.c @ 1436:60fc6476e044

Update to libtommath v1.0
author Matt Johnston <matt@ucc.asn.au>
date Sat, 24 Jun 2017 22:37:14 +0800
parents 5ff8218bcee9
children 8bba51a55704
comparison
equal deleted inserted replaced
1435:f849a5ca2efc 1436:60fc6476e044
1 #include <tommath.h> 1 #include <tommath_private.h>
2 #ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C 2 #ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis 3 /* LibTomMath, multiple-precision integer library -- Tom St Denis
4 * 4 *
5 * LibTomMath is a library that provides multiple-precision 5 * LibTomMath is a library that provides multiple-precision
6 * integer arithmetic as well as number theoretic functionality. 6 * integer arithmetic as well as number theoretic functionality.
10 * additional optimizations in place. 10 * additional optimizations in place.
11 * 11 *
12 * The library is free for all purposes without any express 12 * The library is free for all purposes without any express
13 * guarantee it works. 13 * guarantee it works.
14 * 14 *
15 * Tom St Denis, [email protected], http://math.libtomcrypt.com 15 * Tom St Denis, [email protected], http://libtom.org
16 */ 16 */
17 17
18 /* this is a modified version of fast_s_mul_digs that only produces 18 /* this is a modified version of fast_s_mul_digs that only produces
19 * output digits *above* digs. See the comments for fast_s_mul_digs 19 * output digits *above* digs. See the comments for fast_s_mul_digs
20 * to see how it works. 20 * to see how it works.
73 /* setup dest */ 73 /* setup dest */
74 olduse = c->used; 74 olduse = c->used;
75 c->used = pa; 75 c->used = pa;
76 76
77 { 77 {
78 register mp_digit *tmpc; 78 mp_digit *tmpc;
79 79
80 tmpc = c->dp + digs; 80 tmpc = c->dp + digs;
81 for (ix = digs; ix < pa; ix++) { 81 for (ix = digs; ix < pa; ix++) {
82 /* now extract the previous digit [below the carry] */ 82 /* now extract the previous digit [below the carry] */
83 *tmpc++ = W[ix]; 83 *tmpc++ = W[ix];
91 mp_clamp (c); 91 mp_clamp (c);
92 return MP_OKAY; 92 return MP_OKAY;
93 } 93 }
94 #endif 94 #endif
95 95
96 /* $Source: /cvs/libtom/libtommath/bn_fast_s_mp_mul_high_digs.c,v $ */ 96 /* $Source$ */
97 /* $Revision: 1.5 $ */ 97 /* $Revision$ */
98 /* $Date: 2006/11/14 03:46:25 $ */ 98 /* $Date$ */