X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Finternal%2Flibm.h;h=72ad17d8ebe802e4c48e3fea3187063f9a650cfc;hb=775bde6b5c04ecc689ecbb4a25ceaf2ed6ab60c8;hp=62da4bdb29f1ae0ed88303f058c2b65c1164deb7;hpb=4f8acf953ccf1a978a3378db7fb1e8d5a7afbca1;p=musl diff --git a/src/internal/libm.h b/src/internal/libm.h index 62da4bdb..72ad17d8 100644 --- a/src/internal/libm.h +++ b/src/internal/libm.h @@ -59,6 +59,43 @@ union ldshape { #error Unsupported long double representation #endif +/* Support non-nearest rounding mode. */ +#define WANT_ROUNDING 1 +/* Support signaling NaNs. */ +#define WANT_SNAN 0 + +#if WANT_SNAN +#error SNaN is unsupported +#else +#define issignalingf_inline(x) 0 +#define issignaling_inline(x) 0 +#endif + +#ifndef TOINT_INTRINSICS +#define TOINT_INTRINSICS 0 +#endif + +#if TOINT_INTRINSICS +/* Round x to nearest int in all rounding modes, ties have to be rounded + consistently with converttoint so the results match. If the result + would be outside of [-2^31, 2^31-1] then the semantics is unspecified. */ +static double_t roundtoint(double_t); + +/* Convert x to nearest int in all rounding modes, ties have to be rounded + consistently with roundtoint. If the result is not representible in an + int32_t then the semantics is unspecified. */ +static int32_t converttoint(double_t); +#endif + +/* Helps static branch prediction so hot path can be better optimized. */ +#ifdef __GNUC__ +#define predict_true(x) __builtin_expect(!!(x), 1) +#define predict_false(x) __builtin_expect(x, 0) +#else +#define predict_true(x) (x) +#define predict_false(x) (x) +#endif + /* Evaluate an expression as the specified type. With standard excess precision handling a type cast or assignment is enough (with -ffloat-store an assignment is required, in old compilers argument @@ -117,7 +154,8 @@ static inline long double fp_barrierl(long double x) #define fp_force_evalf fp_force_evalf static inline void fp_force_evalf(float x) { - volatile float y = x; + volatile float y; + y = x; } #endif @@ -125,7 +163,8 @@ static inline void fp_force_evalf(float x) #define fp_force_eval fp_force_eval static inline void fp_force_eval(double x) { - volatile double y = x; + volatile double y; + y = x; } #endif @@ -133,7 +172,8 @@ static inline void fp_force_eval(double x) #define fp_force_evall fp_force_evall static inline void fp_force_evall(long double x) { - volatile long double y = x; + volatile long double y; + y = x; } #endif @@ -196,13 +236,13 @@ hidden int __rem_pio2(double,double*); hidden double __sin(double,double,int); hidden double __cos(double,double); hidden double __tan(double,double,int); -hidden double __expo2(double); +hidden double __expo2(double,double); hidden int __rem_pio2f(float,double*); hidden float __sindf(double); hidden float __cosdf(double); hidden float __tandf(double,int); -hidden float __expo2f(float); +hidden float __expo2f(float,float); hidden int __rem_pio2l(long double, long double *); hidden long double __sinl(long double, long double, int); @@ -227,5 +267,8 @@ hidden double __math_uflow(uint32_t); hidden double __math_oflow(uint32_t); hidden double __math_divzero(uint32_t); hidden double __math_invalid(double); +#if LDBL_MANT_DIG != DBL_MANT_DIG +hidden long double __math_invalidl(long double); +#endif #endif