diff options
| author | bellard <bellard> | 2002-03-17 11:32:48 +0000 |
|---|---|---|
| committer | bellard <bellard> | 2002-03-17 11:32:48 +0000 |
| commit | 7f4fcf12168dbd5c7674669b0856018d132211b0 (patch) | |
| tree | 1fce8f868279b95625f4f342bfac02b830fa68d8 | |
| parent | 22ce5f248a43f018a7fe1713245616888fc70081 (diff) | |
| download | tinycc-7f4fcf12168dbd5c7674669b0856018d132211b0.tar.gz tinycc-7f4fcf12168dbd5c7674669b0856018d132211b0.tar.bz2 | |
added tcc finite math function to avoid portability problems
| -rw-r--r-- | tcc.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -672,6 +672,15 @@ unsigned long long __ldtoull(long double a) /********************************************************/ +/* we use our own 'finite' function to avoid potential problems with + non standard math libs */ +/* XXX: endianness dependant */ +int ieee_finite(double d) +{ + int *p = (int *)&d; + return ((unsigned)((p[1] | 0x800fffff) + 1)) >> 31; +} + /* copy a string and truncate it. */ char *pstrcpy(char *buf, int buf_size, const char *s) { @@ -3107,7 +3116,7 @@ void gen_opif(int op) /* NOTE: we only do constant propagation if finite number (not NaN or infinity) (ANSI spec) */ - if (!finite(f1) || !finite(f2)) + if (!ieee_finite(f1) || !ieee_finite(f2)) goto general_case; switch(op) { |
