Mercurial > dropbear
comparison bn_fast_s_mp_mul_high_digs.c @ 386:97db060d0ef5 libtommath-orig libtommath-0.40
Update to LibTomMath 0.40
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 11 Jan 2007 03:11:15 +0000 |
parents | 91fbc376f010 |
children |
comparison
equal
deleted
inserted
replaced
282:91fbc376f010 | 386:97db060d0ef5 |
---|---|
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.org | 15 * Tom St Denis, [email protected], http://math.libtomcrypt.com |
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. |
68 | 68 |
69 /* make next carry */ | 69 /* make next carry */ |
70 _W = _W >> ((mp_word)DIGIT_BIT); | 70 _W = _W >> ((mp_word)DIGIT_BIT); |
71 } | 71 } |
72 | 72 |
73 /* store final carry */ | |
74 W[ix] = (mp_digit)(_W & MP_MASK); | |
75 | |
76 /* setup dest */ | 73 /* setup dest */ |
77 olduse = c->used; | 74 olduse = c->used; |
78 c->used = pa; | 75 c->used = pa; |
79 | 76 |
80 { | 77 { |
81 register mp_digit *tmpc; | 78 register mp_digit *tmpc; |
82 | 79 |
83 tmpc = c->dp + digs; | 80 tmpc = c->dp + digs; |
84 for (ix = digs; ix <= pa; ix++) { | 81 for (ix = digs; ix < pa; ix++) { |
85 /* now extract the previous digit [below the carry] */ | 82 /* now extract the previous digit [below the carry] */ |
86 *tmpc++ = W[ix]; | 83 *tmpc++ = W[ix]; |
87 } | 84 } |
88 | 85 |
89 /* clear unused digits [that existed in the old copy of c] */ | 86 /* clear unused digits [that existed in the old copy of c] */ |
93 } | 90 } |
94 mp_clamp (c); | 91 mp_clamp (c); |
95 return MP_OKAY; | 92 return MP_OKAY; |
96 } | 93 } |
97 #endif | 94 #endif |
95 | |
96 /* $Source: /cvs/libtom/libtommath/bn_fast_s_mp_mul_high_digs.c,v $ */ | |
97 /* $Revision: 1.5 $ */ | |
98 /* $Date: 2006/11/14 03:46:25 $ */ |