diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-09-15 14:44:00 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-09-15 14:44:00 (GMT) |
commit | d4e73bcab52ca3c76e007a1acc7cb76f50b8feb5 (patch) | |
tree | 4598f9d64ea232476fcf18bbef6bd413444c0c07 /libtommath/bn_mp_montgomery_calc_normalization.c | |
parent | ce32fdecb2337a3ce69b0fb71295c46478019e86 (diff) | |
download | tcl-d4e73bcab52ca3c76e007a1acc7cb76f50b8feb5.zip tcl-d4e73bcab52ca3c76e007a1acc7cb76f50b8feb5.tar.gz tcl-d4e73bcab52ca3c76e007a1acc7cb76f50b8feb5.tar.bz2 |
re-format everything through astyle. Taken from libtom/libtommath (pull request [https://github.com/libtom/libtommath/pull/85|85])
Diffstat (limited to 'libtommath/bn_mp_montgomery_calc_normalization.c')
-rw-r--r-- | libtommath/bn_mp_montgomery_calc_normalization.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/libtommath/bn_mp_montgomery_calc_normalization.c b/libtommath/bn_mp_montgomery_calc_normalization.c index 679a871..2d95140 100644 --- a/libtommath/bn_mp_montgomery_calc_normalization.c +++ b/libtommath/bn_mp_montgomery_calc_normalization.c @@ -21,36 +21,36 @@ * The method is slightly modified to shift B unconditionally upto just under * the leading bit of b. This saves alot of multiple precision shifting. */ -int mp_montgomery_calc_normalization (mp_int * a, mp_int * b) +int mp_montgomery_calc_normalization(mp_int *a, mp_int *b) { - int x, bits, res; + int x, bits, res; - /* how many bits of last digit does b use */ - bits = mp_count_bits (b) % DIGIT_BIT; + /* how many bits of last digit does b use */ + bits = mp_count_bits(b) % DIGIT_BIT; - if (b->used > 1) { - if ((res = mp_2expt (a, ((b->used - 1) * DIGIT_BIT) + bits - 1)) != MP_OKAY) { - return res; - } - } else { - mp_set(a, 1); - bits = 1; - } + if (b->used > 1) { + if ((res = mp_2expt(a, ((b->used - 1) * DIGIT_BIT) + bits - 1)) != MP_OKAY) { + return res; + } + } else { + mp_set(a, 1); + bits = 1; + } - /* now compute C = A * B mod b */ - for (x = bits - 1; x < (int)DIGIT_BIT; x++) { - if ((res = mp_mul_2 (a, a)) != MP_OKAY) { - return res; - } - if (mp_cmp_mag (a, b) != MP_LT) { - if ((res = s_mp_sub (a, b, a)) != MP_OKAY) { - return res; + /* now compute C = A * B mod b */ + for (x = bits - 1; x < (int)DIGIT_BIT; x++) { + if ((res = mp_mul_2(a, a)) != MP_OKAY) { + return res; + } + if (mp_cmp_mag(a, b) != MP_LT) { + if ((res = s_mp_sub(a, b, a)) != MP_OKAY) { + return res; + } } - } - } + } - return MP_OKAY; + return MP_OKAY; } #endif |