X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=device%2Finclude%2Ffloat.h;h=b31679bced10cea40910f3a40de507852c9dec9c;hb=a8a7fc8a514bc79114c6d76d6a6aeb885387478c;hp=5870fdb8a4724ec7a35024b78143ea7c5f2d9a2c;hpb=8bcea68f26d5b6764fe458b1a5a5520a52bd7a60;p=fw%2Fsdcc diff --git a/device/include/float.h b/device/include/float.h index 5870fdb8..b31679bc 100644 --- a/device/include/float.h +++ b/device/include/float.h @@ -41,12 +41,13 @@ /* the following deal with IEEE single-precision numbers */ #define EXCESS 126 #define SIGNBIT ((unsigned long)0x80000000) -#define HIDDEN (unsigned long)(1 << 23) -#define SIGN(fp) ((fp >> (8*sizeof(fp)-1)) & 1) -#define EXP(fp) (((fp) >> 23) & (unsigned int) 0x00FF) +#define __INFINITY ((unsigned long)0x7F800000) +#define HIDDEN (unsigned long)(1ul << 23) +#define SIGN(fp) (((unsigned long)(fp) >> (8*sizeof(fp)-1)) & 1) +#define EXP(fp) (((unsigned long)(fp) >> 23) & (unsigned int) 0x00FF) #define MANT(fp) (((fp) & (unsigned long)0x007FFFFF) | HIDDEN) #define NORM 0xff000000 -#define PACK(s,e,m) ((s) | ((e) << 23) | (m)) +#define PACK(s,e,m) ((s) | ((unsigned long)(e) << 23) | (m)) float __uchar2fs (unsigned char); float __schar2fs (signed char); @@ -68,11 +69,30 @@ float __fsdiv (float, float); char __fslt (float, float); char __fseq (float, float); -char __fsqt (float, float); +char __fsgt (float, float); -#endif +#if defined(SDCC_FLOAT_LIB) && defined(SDCC_mcs51) && !defined(SDCC_USE_XSTACK) && !defined(_SDCC_NO_ASM_LIB_FUNCS) +#define FLOAT_ASM_MCS51 +// This adds extra code for proper round-off, in +// an attempt to match the results from gcc. +#define FLOAT_FULL_ACCURACY +// This adds about 66 bytes to the code size and +// significantly speeds up shift operations more +// than 8 bits (common when subtracting numbers +// of significantly different magnitude and scaling +// to fixed point) +#define FLOAT_SHIFT_SPEEDUP + +#define sign_a psw.1 +#define sign_b psw.5 +#define exp_a dpl +#define exp_b dph +#endif // using mcs51 assembly + + +#endif // __SDC51_FLOAT_H