summaryrefslogtreecommitdiff
path: root/libc/ports/sysdeps/arm/fegetround.c
diff options
context:
space:
mode:
authorWilco <wdijkstr@arm.com>2014-05-15 15:18:40 +0100
committerWill Newton <will.newton@linaro.org>2014-06-06 11:50:29 +0100
commit074ae1942e811a459e811674a7b70186d3abc6ff (patch)
treefccd7f52155fd602b0ccbd0ee15e1a0828e89d46 /libc/ports/sysdeps/arm/fegetround.c
parent0c7017122ba59c4366b89d0b78f0834e458a69b5 (diff)
ARM: Improve fenv implementation
Diffstat (limited to 'libc/ports/sysdeps/arm/fegetround.c')
-rw-r--r--libc/ports/sysdeps/arm/fegetround.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/libc/ports/sysdeps/arm/fegetround.c b/libc/ports/sysdeps/arm/fegetround.c
index cb4cf1bce..1c9c151a1 100644
--- a/libc/ports/sysdeps/arm/fegetround.c
+++ b/libc/ports/sysdeps/arm/fegetround.c
@@ -24,17 +24,14 @@
int
fegetround (void)
{
- if (ARM_HAVE_VFP)
- {
- unsigned int temp;
+ fpu_control_t fpscr;
- /* Get the current environment. */
- _FPU_GETCW (temp);
+ /* FE_TONEAREST is the only supported rounding mode
+ if a VFP unit isn't present. */
+ if (!ARM_HAVE_VFP)
+ return FE_TONEAREST;
- return temp & FE_TOWARDZERO;
- }
-
- /* The current soft-float implementation only handles TONEAREST. */
- return FE_TONEAREST;
+ _FPU_GETCW (fpscr);
+ return fpscr & FE_TOWARDZERO;
}
libm_hidden_def (fegetround)