aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/arm/fsetexcptflg.c
diff options
context:
space:
mode:
authorWilco <wdijkstr@arm.com>2014-05-15 15:18:40 +0100
committerMarcus Shawcroft <marcus.shawcroft@arm.com>2014-05-15 15:23:27 +0100
commit1a2f40e5d14ed6450696feacf04fca5eeceae7ef (patch)
treef08d34c9426d8833b6daef1509a1ac431e0b3c0b /sysdeps/arm/fsetexcptflg.c
parentcf26a0cb6a0bbaca46a01ddad6662e5e5159a32a (diff)
downloadglibc-1a2f40e5d14ed6450696feacf04fca5eeceae7ef.zip
glibc-1a2f40e5d14ed6450696feacf04fca5eeceae7ef.tar.gz
glibc-1a2f40e5d14ed6450696feacf04fca5eeceae7ef.tar.bz2
ARM: Improve fenv implementation
Diffstat (limited to 'sysdeps/arm/fsetexcptflg.c')
-rw-r--r--sysdeps/arm/fsetexcptflg.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/sysdeps/arm/fsetexcptflg.c b/sysdeps/arm/fsetexcptflg.c
index 7e3d007..1a610ff 100644
--- a/sysdeps/arm/fsetexcptflg.c
+++ b/sysdeps/arm/fsetexcptflg.c
@@ -25,24 +25,19 @@
int
fesetexceptflag (const fexcept_t *flagp, int excepts)
{
- if (ARM_HAVE_VFP)
- {
- fexcept_t temp;
+ fpu_control_t fpscr;
- /* Get the current environment. */
- _FPU_GETCW (temp);
+ /* Fail if a VFP unit isn't present unless nothing needs to be done. */
+ if (!ARM_HAVE_VFP)
+ return (excepts != 0);
- /* Set the desired exception mask. */
- temp &= ~(excepts & FE_ALL_EXCEPT);
- temp |= (*flagp & excepts & FE_ALL_EXCEPT);
+ _FPU_GETCW (fpscr);
- /* Save state back to the FPU. */
- _FPU_SETCW (temp);
+ /* Set the desired exception mask. */
+ fpscr &= ~(excepts & FE_ALL_EXCEPT);
+ fpscr |= (*flagp & excepts & FE_ALL_EXCEPT);
- /* Success. */
- return 0;
- }
-
- /* Unsupported, so fail unless nothing needs to be done. */
- return (excepts != 0);
+ /* Save state back to the FPU. */
+ _FPU_SETCW (fpscr);
+ return 0;
}