Add ecvt_r replacement for i386

parent 24e2fdd6
Pipeline #1315 passed with stage
in 15 minutes and 54 seconds
......@@ -429,6 +429,8 @@ Dynamic NC generation disabled."
;;
i*86)
machine=386
test -z "$ac_cv_func_ecvt_r" && ac_cv_func_ecvt_r=no
AC_REPLACE_FUNCS(ecvt_r)
CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr"
CFLAGS_1="$CFLAGS"
CFLAGS="$CFLAGS_1 -march=athlon64 -mtune=generic"
......
......@@ -2589,9 +2589,35 @@ else
r3 = r2;
represent ( r c_addr u -- n f1 f2 ) float
#ifdef HAVE_ECVT_R
char sig[0x40];
size_t siglen;
int flag;
int decpt;
if (isnan(r)) {
flag=0;
decpt=0;
strncpy(sig, "nan", 0x3f); /* normalize nan output */
} else {
ecvt_r(r, u, &decpt, &flag, sig, 0x3f);
}
n=(r==0. ? 1 : decpt);
flag=signbit(r); /* not all ecvt()s do this as desired */
f1=FLAG(flag!=0);
f2=FLAG(isdigit((unsigned)(sig[0]))!=0);
siglen=strlen((char *)sig);
if (siglen>u) /* happens in glibc-2.1.3 if 999.. is rounded up */
siglen=u;
if (!f2) /* workaround Cygwin trailing 0s for Inf and Nan */
for (; sig[siglen-1]=='0'; siglen--);
;
memmove(c_addr,sig,siglen);
memset(c_addr+siglen,f2?'0':' ',u-siglen);
#else
struct Cellpair fs = represent(r, c_addr, u, &n);
f1 = fs.n1;
f2 = fs.n2;
#endif
>float ( c_addr u -- f:... flag ) float to_float
""Actual stack effect: ( c_addr u -- r t | f ). Attempt to convert the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment