* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*
***************************************************************/
+#include "config.h"
#include "strtod.h"
#include <glib.h>
#define freedtoa __freedtoa
#define dtoa __dtoa
+#define Omit_Private_Memory
+#define MULTIPLE_THREADS 1
+/* Lock 0 is not used because of USE_MALLOC, Lock 1 protects a lazy-initialized table */
+#define ACQUIRE_DTOA_LOCK(n)
+#define FREE_DTOA_LOCK(n)
+
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
* #define NO_ERRNO if strtod should not assign errno = ERANGE when
* the result overflows to +-Infinity or underflows to 0.
*/
-#if defined(i386) || defined(mips) && defined(MIPSEL) || defined (__arm__)
+#if defined(TARGET_X86) || defined(mips) && defined(MIPSEL) || defined (__arm__)
# define IEEE_8087
-#elif defined(__x86_64__) || defined(__alpha__)
+#elif defined(TARGET_AMD64) || defined(__alpha__)
# define IEEE_8087
#define MALLOC malloc
#endif
+#define Omit_Private_Memory
#ifndef Omit_Private_Memory
#ifndef PRIVATE_MEM
#define PRIVATE_MEM 2304
(Bigint *v)
#endif
{
+#ifdef Omit_Private_Memory
+ free (v);
+#else
if (v) {
ACQUIRE_DTOA_LOCK(0);
v->next = freelist[v->k];
freelist[v->k] = v;
FREE_DTOA_LOCK(0);
- }
}
+#endif
+}
#define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \
y->wds*sizeof(Long) + 2*sizeof(int))
*e = 32 - k;
#ifdef Pack_32
if (k < Ebits) {
- d0 = Exp_1 | y >> Ebits - k;
+ d0 = Exp_1 | (y >> (Ebits - k));
w = xa > xa0 ? *--xa : 0;
- d1 = y << (32-Ebits) + k | w >> Ebits - k;
+ d1 = y << ((32-Ebits) + k) | (w >> (Ebits - k));
goto ret_d;
}
z = xa > xa0 ? *--xa : 0;
if (k -= Ebits) {
- d0 = Exp_1 | y << k | z >> 32 - k;
+ d0 = Exp_1 | y << k | (z >> (32 - k));
y = xa > xa0 ? *--xa : 0;
- d1 = z << k | y >> 32 - k;
+ d1 = z << k | (y >> (32 - k));
}
else {
d0 = Exp_1 | y;
#ifdef Pack_32
if ((y = d1)) {
if ((k = lo0bits(&y))) {
- x[0] = y | z << 32 - k;
+ x[0] = y | (z << (32 - k));
z >>= k;
}
else
#endif /*No_Hex_NaN*/
#endif /* INFNAN_CHECK */
+ /*
+ * LOCKING: This is not thread-safe, since the locking macros are defined as no-ops,
+ * the caller should lock.
+ */
+
double
-bsd_strtod
+mono_strtod
#ifdef KR_headers
(s00, se) CONST char *s00; char **se;
#else
double aadj, aadj1, adj, rv, rv0;
Long L;
ULong y, z;
- Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
+ Bigint *bb = NULL, *bb1, *bd = NULL, *bd0, *bs = NULL, *delta = NULL;
#ifdef SET_INEXACT
int inexact, oldinexact;
#endif
if (j >= 53)
word0(rv) = (P+2)*Exp_msk1;
else
- word0(rv) &= 0xffffffff << j-32;
+ word0(rv) &= 0xffffffff << (j-32);
}
else
word1(rv) &= 0xffffffff << j;
* when MULTIPLE_THREADS is not defined.
*/
-void freedtoa (char *s);
+static void freedtoa (char *s);
- void
+static void
#ifdef KR_headers
freedtoa(s) char *s;
#else