aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/arm/fclrexcpt.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/fclrexcpt.c
parentcf26a0cb6a0bbaca46a01ddad6662e5e5159a32a (diff)
downloadglibc-1a2f40e5d14ed6450696feacf04fca5eeceae7ef.zip
glibc-1a2f40e5d14ed6450696feacf04fca5eeceae7ef.tar.gz
glibc-1a2f40e5d14ed6450696feacf04fca5eeceae7ef.tar.bz2
ARM: Improve fenv implementation
Diffstat (limited to 'sysdeps/arm/fclrexcpt.c')
-rw-r--r--sysdeps/arm/fclrexcpt.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/sysdeps/arm/fclrexcpt.c b/sysdeps/arm/fclrexcpt.c
index 72eaab9..cbf61a6 100644
--- a/sysdeps/arm/fclrexcpt.c
+++ b/sysdeps/arm/fclrexcpt.c
@@ -24,27 +24,20 @@
int
feclearexcept (int excepts)
{
- if (ARM_HAVE_VFP)
- {
- unsigned long int temp;
+ fpu_control_t fpscr;
- /* Mask out unsupported bits/exceptions. */
- excepts &= FE_ALL_EXCEPT;
+ /* Fail if a VFP unit isn't present unless nothing needs to be done. */
+ if (!ARM_HAVE_VFP)
+ return (excepts != 0);
- /* Get the current floating point status. */
- _FPU_GETCW (temp);
+ _FPU_GETCW (fpscr);
+ excepts &= FE_ALL_EXCEPT;
- /* Clear the relevant bits. */
- temp = (temp & ~FE_ALL_EXCEPT) | (temp & FE_ALL_EXCEPT & ~excepts);
+ /* Clear the relevant bits. */
+ fpscr = (fpscr & ~FE_ALL_EXCEPT) | (fpscr & FE_ALL_EXCEPT & ~excepts);
- /* Put the new data in effect. */
- _FPU_SETCW (temp);
+ _FPU_SETCW (fpscr);
- /* Success. */
- return 0;
- }
-
- /* Unsupported, so fail unless nothing needs to be done. */
- return (excepts != 0);
+ return 0;
}
libm_hidden_def (feclearexcept)