aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/gmp/gmp-4.2.2/mpf_set_str_c.diff
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/gmp/gmp-4.2.2/mpf_set_str_c.diff')
-rw-r--r--recipes/gmp/gmp-4.2.2/mpf_set_str_c.diff38
1 files changed, 38 insertions, 0 deletions
diff --git a/recipes/gmp/gmp-4.2.2/mpf_set_str_c.diff b/recipes/gmp/gmp-4.2.2/mpf_set_str_c.diff
new file mode 100644
index 0000000000..1924611640
--- /dev/null
+++ b/recipes/gmp/gmp-4.2.2/mpf_set_str_c.diff
@@ -0,0 +1,38 @@
+*** gmp-4.2.2.orig/mpf/set_str.c 30 Aug 2007 18:19:41 -0000
+--- gmp-4.2.2/mpf/set_str.c 10 Dec 2007 04:47:18 -0000
+*************** mpf_set_str (mpf_ptr x, const char *str,
+*** 272,277 ****
+
+ if (expptr != 0)
+! /* FIXME: Should do some error checking here. */
+! exp_in_base = strtol (expptr, (char **) 0, exp_base);
+ else
+ exp_in_base = 0;
+--- 272,298 ----
+
+ if (expptr != 0)
+! {
+! /* Scan and convert the exponent, in base exp_base. */
+! long dig, neg = -(long) ('-' == expptr[0]);
+! expptr -= neg; /* conditional increment */
+! c = (unsigned char) *expptr++;
+! dig = digit_value[c];
+! if (dig >= exp_base)
+! {
+! TMP_FREE;
+! return -1;
+! }
+! exp_in_base = dig;
+! c = (unsigned char) *expptr++;
+! dig = digit_value[c];
+! while (dig < exp_base)
+! {
+! exp_in_base = exp_in_base * exp_base;
+! exp_in_base += dig;
+! c = (unsigned char) *expptr++;
+! dig = digit_value[c];
+! }
+! exp_in_base = (exp_in_base ^ neg) - neg; /* conditional negation */
+! }
+ else
+ exp_in_base = 0;