From 884551a999bbfd8b9186c85525d0b6b03bb674dc Mon Sep 17 00:00:00 2001 From: wbhart Date: Sun, 14 Sep 2008 02:07:24 +0000 Subject: [PATCH] Second part of patch to patch for mpf_set_str (fix to the base issue). --- mpf/set_str.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mpf/set_str.c b/mpf/set_str.c index 3c123527..6a62ca21 100644 --- a/mpf/set_str.c +++ b/mpf/set_str.c @@ -276,8 +276,11 @@ mpf_set_str (mpf_ptr x, const char *str, int base) if (expptr != 0) { /* Scan and convert the exponent, in base exp_base. */ - long dig, neg = -(long) ('-' == expptr[0]); - expptr -= neg; /* conditional increment */ + long dig, minus, plusminus; + c = (unsigned char) *expptr; + minus = -(long) (c == '-'); + plusminus = minus | -(long) (c == '+'); + expptr -= plusminus; /* conditional increment */ c = (unsigned char) *expptr++; dig = digit_value[c]; if (dig >= exp_base) @@ -295,7 +298,7 @@ mpf_set_str (mpf_ptr x, const char *str, int base) c = (unsigned char) *expptr++; dig = digit_value[c]; } - exp_in_base = (exp_in_base ^ neg) - neg; /* conditional negation */ + exp_in_base = (exp_in_base ^ minus) - minus; /* conditional negation */ } else exp_in_base = 0;