about summary refs log tree commit diff
path: root/sysdeps/arm/feholdexcpt.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/feholdexcpt.c
parentcf26a0cb6a0bbaca46a01ddad6662e5e5159a32a (diff)
downloadglibc-1a2f40e5d14ed6450696feacf04fca5eeceae7ef.tar.gz
glibc-1a2f40e5d14ed6450696feacf04fca5eeceae7ef.tar.xz
glibc-1a2f40e5d14ed6450696feacf04fca5eeceae7ef.zip
ARM: Improve fenv implementation
Diffstat (limited to 'sysdeps/arm/feholdexcpt.c')
-rw-r--r--sysdeps/arm/feholdexcpt.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/sysdeps/arm/feholdexcpt.c b/sysdeps/arm/feholdexcpt.c
index 9ca673c6fb..258ba6637f 100644
--- a/sysdeps/arm/feholdexcpt.c
+++ b/sysdeps/arm/feholdexcpt.c
@@ -24,27 +24,23 @@
 int
 feholdexcept (fenv_t *envp)
 {
-  if (ARM_HAVE_VFP)
-    {
-      unsigned long int temp;
+  fpu_control_t fpscr;
 
-      /* Store the environment.  */
-      _FPU_GETCW(temp);
-      envp->__cw = temp;
+  /* Fail if a VFP unit isn't present.  */
+  if (!ARM_HAVE_VFP)
+    return 1;
 
-      /* Now set all exceptions to non-stop.  */
-      temp &= ~(FE_ALL_EXCEPT << FE_EXCEPT_SHIFT);
+  _FPU_GETCW (fpscr);
+  envp->__cw = fpscr;
 
-      /* And clear all exception flags.  */
-      temp &= ~FE_ALL_EXCEPT;
+  /* Now set all exceptions to non-stop.  */
+  fpscr &= ~(FE_ALL_EXCEPT << FE_EXCEPT_SHIFT);
 
-      _FPU_SETCW(temp);
+  /* And clear all exception flags.  */
+  fpscr &= ~FE_ALL_EXCEPT;
 
-      return 0;
-    }
-
-  /* Unsupported, so fail.  */
-  return 1;
+  _FPU_SETCW (fpscr);
+  return 0;
 }
 
 libm_hidden_def (feholdexcept)