mirror of
git://repo.or.cz/tinycc.git
synced 2026-11-04 21:26:36 +08:00
win32: simplify tcc 0.9.27 self-host (part 2 of 2)
Some checks failed
build and test / test-x86_64-linux (push) Has been cancelled
build and test / test-x86_64-osx (push) Has been cancelled
build and test / test-aarch64-osx (push) Has been cancelled
build and test / test-x86_64-win32 (push) Has been cancelled
build and test / test-i386-win32 (push) Has been cancelled
build and test / test-arm64-win32 (push) Has been cancelled
build and test / test-armv7-linux (push) Has been cancelled
build and test / test-aarch64-linux (push) Has been cancelled
build and test / test-riscv64-linux (push) Has been cancelled
build and test / test-i386-linux (push) Has been cancelled
Some checks failed
build and test / test-x86_64-linux (push) Has been cancelled
build and test / test-x86_64-osx (push) Has been cancelled
build and test / test-aarch64-osx (push) Has been cancelled
build and test / test-x86_64-win32 (push) Has been cancelled
build and test / test-i386-win32 (push) Has been cancelled
build and test / test-arm64-win32 (push) Has been cancelled
build and test / test-armv7-linux (push) Has been cancelled
build and test / test-aarch64-linux (push) Has been cancelled
build and test / test-riscv64-linux (push) Has been cancelled
build and test / test-i386-linux (push) Has been cancelled
tcc 0.9.27 does have a usable ldexp - but not ldexpl. however, on windows these functions are identical, so map ldexpl to ldexp and remove the MUSL-implementation which was copied from tcc_libm.h.
This commit is contained in:
parent
add111e6fe
commit
d9d02c5640
42
tccpp.c
42
tccpp.c
@ -24,44 +24,16 @@
|
|||||||
#if defined(_WIN32) && defined(__TINYC__)
|
#if defined(_WIN32) && defined(__TINYC__)
|
||||||
/* allow self-host build with tcc 0.9.27 - doesn't have ldexpl in tcc_libm.h .
|
/* allow self-host build with tcc 0.9.27 - doesn't have ldexpl in tcc_libm.h .
|
||||||
*
|
*
|
||||||
* we can't feature-test whether we have ldexpl, and our ./configure also
|
* in tcc 0.9.27 both ldexp and ldexpl are declared in win32/include/math.h,
|
||||||
* can't perform such tests (and it's also not used by win32/build-tcc.bat),
|
* but only ldexp can be linked - via win32/lib/msvcrt.def. we can't test
|
||||||
* so define it unconditionally if we're compiling using tcc on windows
|
* whether we have ldexpl or not, so map ldexpl to ldexp unconditionally.
|
||||||
* (otherwise the platform's math.h should already have ldexpl).
|
|
||||||
*
|
*
|
||||||
* we could instead include win32/include/math.h (specifically tcc_libm.h),
|
* note that ldexpl takes long double while ldexp takes double, however, on
|
||||||
* but this requires working around include guards and redefinitions,
|
* windows these types are identical, and current ldexpl in tcc_libm.h also
|
||||||
* so KISS - copy the tcc_libm.h definitions here with a different name.
|
* uses the "normal" double scalbn - just like ldexp, so do the same here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#undef ldexpl
|
#undef ldexpl
|
||||||
#define ldexpl ldexpl_local
|
#define ldexpl ldexp
|
||||||
|
|
||||||
/* MUSL scalbn - (renamed) copied from win32/include/tcc/tcc_libm.h */
|
|
||||||
static double scalbn_local(double x, int n) {
|
|
||||||
union {double f; uint64_t i;} u;
|
|
||||||
if (n > 1023) {
|
|
||||||
x *= 0x1p1023, n -= 1023;
|
|
||||||
if (n > 1023) {
|
|
||||||
x *= 0x1p1023, n -= 1023;
|
|
||||||
if (n > 1023) n = 1023;
|
|
||||||
}
|
|
||||||
} else if (n < -1022) {
|
|
||||||
x *= 0x1p-1022 * 0x1p53, n += 1022 - 53;
|
|
||||||
if (n < -1022) {
|
|
||||||
x *= 0x1p-1022 * 0x1p53, n += 1022 - 53;
|
|
||||||
if (n < -1022) n = -1022;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
u.i = (0x3ffull + n) << 52;
|
|
||||||
return x * u.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (windows long double is the same type as double - 64bit) */
|
|
||||||
/* (renamed) copied from win32/include/tcc/tcc_libm.h */
|
|
||||||
static long double ldexpl_local(long double x, int exp) {
|
|
||||||
return scalbn_local(x, exp);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* #define to 1 to enable (see parse_pp_string()) */
|
/* #define to 1 to enable (see parse_pp_string()) */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user