diff options
Diffstat (limited to 'libtommath/bn_mp_fread.c')
-rw-r--r-- | libtommath/bn_mp_fread.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libtommath/bn_mp_fread.c b/libtommath/bn_mp_fread.c index 140721b..d0de595 100644 --- a/libtommath/bn_mp_fread.c +++ b/libtommath/bn_mp_fread.c @@ -20,10 +20,10 @@ int mp_fread(mp_int *a, int radix, FILE *stream) { int err, ch, neg, y; - + /* clear a */ mp_zero(a); - + /* if first digit is - then set negative */ ch = fgetc(stream); if (ch == '-') { @@ -32,18 +32,18 @@ int mp_fread(mp_int *a, int radix, FILE *stream) } else { neg = MP_ZPOS; } - + for (;;) { /* find y in the radix map */ for (y = 0; y < radix; y++) { - if (mp_s_rmap[y] == ch) { - break; - } + if (mp_s_rmap[y] == ch) { + break; + } } if (y == radix) { break; } - + /* shift up and add */ if ((err = mp_mul_d(a, radix, a)) != MP_OKAY) { return err; @@ -51,13 +51,13 @@ int mp_fread(mp_int *a, int radix, FILE *stream) if ((err = mp_add_d(a, y, a)) != MP_OKAY) { return err; } - + ch = fgetc(stream); } if (mp_cmp_d(a, 0) != MP_EQ) { a->sign = neg; } - + return MP_OKAY; } #endif |