about summary refs log tree commit diff
path: root/sysdeps/arm/fedisblxcpt.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/arm/fedisblxcpt.c')
-rw-r--r--sysdeps/arm/fedisblxcpt.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/sysdeps/arm/fedisblxcpt.c b/sysdeps/arm/fedisblxcpt.c
index 88da539439..f2956cd32a 100644
--- a/sysdeps/arm/fedisblxcpt.c
+++ b/sysdeps/arm/fedisblxcpt.c
@@ -25,23 +25,17 @@
 int
 fedisableexcept (int excepts)
 {
-  if (ARM_HAVE_VFP)
-    {
-      unsigned long int new_exc, old_exc;
+  fpu_control_t fpscr, new_fpscr;
 
-      _FPU_GETCW(new_exc);
+  /* Fail if a VFP unit isn't present.  */
+  if (!ARM_HAVE_VFP)
+    return -1;
 
-      old_exc = (new_exc >> FE_EXCEPT_SHIFT) & FE_ALL_EXCEPT;
+  _FPU_GETCW (fpscr);
+  excepts &= FE_ALL_EXCEPT;
+  new_fpscr = fpscr & ~(excepts << FE_EXCEPT_SHIFT);
 
-      excepts &= FE_ALL_EXCEPT;
+  _FPU_SETCW (new_fpscr);
 
-      new_exc &= ~(excepts << FE_EXCEPT_SHIFT);
-
-      _FPU_SETCW(new_exc);
-
-      return old_exc;
-    }
-
-  /* Unsupported, so return -1 for failure.  */
-  return -1;
+  return (fpscr >> FE_EXCEPT_SHIFT) & FE_ALL_EXCEPT;
 }