diff options
author | Szabolcs Nagy <nsz@port70.net> | 2013-08-18 20:08:18 +0000 |
---|---|---|
committer | Szabolcs Nagy <nsz@port70.net> | 2013-08-18 20:08:18 +0000 |
commit | a6b0170a7f51fdea9beec57ae794221290af232b (patch) | |
tree | 22651ba3480fc272933133af780e6beb10ab2d3d /src/fenv/fesetround.c | |
parent | d8764bf84022397ff9d22310f78fcd78d801e2bf (diff) | |
download | musl-a6b0170a7f51fdea9beec57ae794221290af232b.tar.gz musl-a6b0170a7f51fdea9beec57ae794221290af232b.tar.xz musl-a6b0170a7f51fdea9beec57ae794221290af232b.zip |
fix fenv exception functions to mask their argument
fesetround.c is a wrapper to do the arch independent argument check (on archs where rounding mode is not stored in 2 bits __fesetround still has to check its arguments) on powerpc fe*except functions do not accept the extra invalid flags of its fpscr register the useless FENV_ACCESS pragma was removed from feupdateenv
Diffstat (limited to 'src/fenv/fesetround.c')
-rw-r--r-- | src/fenv/fesetround.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/fenv/fesetround.c b/src/fenv/fesetround.c new file mode 100644 index 00000000..9bbd4ade --- /dev/null +++ b/src/fenv/fesetround.c @@ -0,0 +1,23 @@ +#include <fenv.h> + +/* __fesetround wrapper for arch independent argument check */ + +int __fesetround(int); + +int fesetround(int r) +{ + if (r & ~( + FE_TONEAREST +#ifdef FE_DOWNWARD + |FE_DOWNWARD +#endif +#ifdef FE_UPWARD + |FE_UPWARD +#endif +#ifdef FE_TOWARDZERO + |FE_TOWARDZERO +#endif + )) + return -1; + return __fesetround(r); +} |