add imath-1.7

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18759 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-10-21 16:32:36 +00:00
parent 8833c418b6
commit b4c55d807b
2 changed files with 14 additions and 14 deletions

View File

@@ -1191,11 +1191,11 @@ mp_result mp_int_exptmod(mp_int a, mp_int b, mp_int m, mp_int c)
return MP_RANGE; return MP_RANGE;
um = MP_USED(m); um = MP_USED(m);
SETUP(mp_int_init_size(TEMP(0), 3 * um), last); SETUP(mp_int_init_size(TEMP(0), 2 * um), last);
SETUP(mp_int_init_size(TEMP(1), 3 * um), last); SETUP(mp_int_init_size(TEMP(1), 2 * um), last);
if(c == b || c == m) { if(c == b || c == m) {
SETUP(mp_int_init_size(TEMP(2), 3 * um), last); SETUP(mp_int_init_size(TEMP(2), 2 * um), last);
s = TEMP(2); s = TEMP(2);
} }
else { else {
@@ -1767,7 +1767,7 @@ mp_result mp_int_read_cstring(mp_int z, mp_size radix, const char *str, char **e
return MP_RANGE; return MP_RANGE;
/* Skip leading whitespace */ /* Skip leading whitespace */
while(isspace((unsigned char)*str)) while(isspace((int)*str))
++str; ++str;
/* Handle leading sign tag (+/-, positive default) */ /* Handle leading sign tag (+/-, positive default) */
@@ -2196,7 +2196,7 @@ static mp_digit s_uadd(mp_digit *da, mp_digit *db, mp_digit *dc,
/* Add corresponding digits until the shorter number runs out */ /* Add corresponding digits until the shorter number runs out */
for(pos = 0; pos < size_b; ++pos, ++da, ++db, ++dc) { for(pos = 0; pos < size_b; ++pos, ++da, ++db, ++dc) {
w = w + (mp_word)*da + (mp_word)*db; w = w + (mp_word) *da + (mp_word) *db;
*dc = LOWER_HALF(w); *dc = LOWER_HALF(w);
w = UPPER_HALF(w); w = UPPER_HALF(w);
} }
@@ -2909,7 +2909,7 @@ mp_result s_embar(mp_int a, mp_int b, mp_int m, mp_int mu, mp_int c)
umu = MP_USED(mu); db = MP_DIGITS(b); dbt = db + MP_USED(b) - 1; umu = MP_USED(mu); db = MP_DIGITS(b); dbt = db + MP_USED(b) - 1;
while(last < 3) while(last < 3)
SETUP(mp_int_init_size(TEMP(last), 2 * umu), last); SETUP(mp_int_init_size(TEMP(last), 4 * umu), last);
(void) mp_int_set_value(c, 1); (void) mp_int_set_value(c, 1);
@@ -3101,10 +3101,10 @@ static int s_ch2val(char c, int r)
{ {
int out; int out;
if(isdigit((unsigned char)c)) if(isdigit((unsigned char) c))
out = c - '0'; out = c - '0';
else if(r > 10 && isalpha((unsigned char)c)) else if(r > 10 && isalpha((unsigned char) c))
out = toupper((unsigned char)c) - 'A' + 10; out = toupper(c) - 'A' + 10;
else else
return -1; return -1;

View File

@@ -800,7 +800,7 @@ mp_result mp_rat_read_cstring(mp_rat r, mp_size radix, const char *str,
return res; return res;
/* Skip whitespace between numerator and (possible) separator */ /* Skip whitespace between numerator and (possible) separator */
while(isspace((unsigned char)*endp)) while(isspace((unsigned char) *endp))
++endp; ++endp;
/* If there is no separator, we will stop reading at this point. */ /* If there is no separator, we will stop reading at this point. */
@@ -915,7 +915,7 @@ mp_result mp_rat_read_cdecimal(mp_rat r, mp_size radix, const char *str,
*end = endp; *end = endp;
return MP_OK; return MP_OK;
} }
else if(isspace((unsigned char)*endp) || *endp == '-' || *endp == '+') { else if(isspace((unsigned char) *endp) || *endp == '-' || *endp == '+') {
return MP_TRUNC; return MP_TRUNC;
} }
else { else {