Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2006-06-22 21:59:52 +0400
committerJeff Johnston <jjohnstn@redhat.com>2006-06-22 21:59:52 +0400
commitf489b5943c8f8655b0a3caddd38114111576ab35 (patch)
treee5db470212203f6eb28752047e58cb287418bc1b /newlib/libc/stdlib/mprec.c
parent09fd280ca40c0b1211d3e8b31c3a813150c57c6b (diff)
2006-06-22 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdlib/Makefile.am: Add new gdtoa routines. * libc/stdlib/Makefile.in: Regenerated. * libc/stdlib/gd_qnan.h: New file. * libc/stdlib/gdtoa-gethex.c: Ditto. * libc/stdlib/gdtoa-hexnan.c: Ditto. * libc/stdlib/gdtoa.h: Ditto. * libc/stdlib/mprec.c: Add new helper routines needed by the new gdtoa code. * libc/stdlib/mprec.h: Integrate some defines and prototypes used by gdtoa routines here. * libc/stdlib/strtod.c: Rebased on David M. Gay's gdtoa-strtod.c which adds C99 support such as nan, inf, and hexadecimal input format.
Diffstat (limited to 'newlib/libc/stdlib/mprec.c')
-rw-r--r--newlib/libc/stdlib/mprec.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/newlib/libc/stdlib/mprec.c b/newlib/libc/stdlib/mprec.c
index 0ef28c745..6e84ece5b 100644
--- a/newlib/libc/stdlib/mprec.c
+++ b/newlib/libc/stdlib/mprec.c
@@ -985,3 +985,61 @@ _DEFUN (_mprec_log10, (dig),
}
return v;
}
+
+void
+_DEFUN (copybits, (c, n, b),
+ __ULong *c _AND
+ int n _AND
+ _Bigint *b)
+{
+ __ULong *ce, *x, *xe;
+#ifdef Pack_16
+ int nw, nw1;
+#endif
+
+ ce = c + ((n-1) >> kshift) + 1;
+ x = b->_x;
+#ifdef Pack_32
+ xe = x + b->_wds;
+ while(x < xe)
+ *c++ = *x++;
+#else
+ nw = b->_wds;
+ nw1 = nw & 1;
+ for(xe = x + (nw - nw1); x < xe; x += 2)
+ Storeinc(c, x[1], x[0]);
+ if (nw1)
+ *c++ = *x;
+#endif
+ while(c < ce)
+ *c++ = 0;
+}
+
+__ULong
+_DEFUN (any_on, (b, k),
+ _Bigint *b _AND
+ int k)
+{
+ int n, nwds;
+ __ULong *x, *x0, x1, x2;
+
+ x = b->_x;
+ nwds = b->_wds;
+ n = k >> kshift;
+ if (n > nwds)
+ n = nwds;
+ else if (n < nwds && (k &= kmask)) {
+ x1 = x2 = x[n];
+ x1 >>= k;
+ x1 <<= k;
+ if (x1 != x2)
+ return 1;
+ }
+ x0 = x;
+ x += n;
+ while(x > x0)
+ if (*--x)
+ return 1;
+ return 0;
+}
+