[powerpc] fegetexcept: utilize function instead of duplicating code
authorPaul A. Clarke <pc@us.ibm.com>
Wed, 5 Jun 2019 13:50:37 +0000 (08:50 -0500)
committerPaul A. Clarke <pc@us.ibm.com>
Thu, 6 Jun 2019 00:38:10 +0000 (19:38 -0500)
fegetexcept() included code which exactly duplicates the code in
fenv_reg_to_exceptions().  Replace with a call to that function.

2019-06-05  Paul A. Clarke  <pc@us.ibm.com>

* sysdeps/powerpc/fpu/fegetexcept.c (__fegetexcept): Replace code
with call to equivalent function.

ChangeLog
sysdeps/powerpc/fpu/fegetexcept.c

index d15a68a..82ae580 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-06-05  Paul A. Clarke  <pc@us.ibm.com>
+
+       * sysdeps/powerpc/fpu/fegetexcept.c (__fegetexcept): Replace code
+       with call to equivalent function.
+
 2019-06-04  Florian Weimer  <fweimer@redhat.com>
 
        * iconv/gconv_dl.c (release_handle): Remove file-level definition.
index daa8812..2173d77 100644 (file)
@@ -23,21 +23,9 @@ int
 __fegetexcept (void)
 {
   fenv_union_t fe;
-  int result = 0;
 
   fe.fenv = fegetenv_register ();
 
-  if (fe.l & (1 << (31 - FPSCR_XE)))
-      result |= FE_INEXACT;
-  if (fe.l & (1 << (31 - FPSCR_ZE)))
-      result |= FE_DIVBYZERO;
-  if (fe.l & (1 << (31 - FPSCR_UE)))
-      result |= FE_UNDERFLOW;
-  if (fe.l & (1 << (31 - FPSCR_OE)))
-      result |= FE_OVERFLOW;
-  if (fe.l & (1 << (31 - FPSCR_VE)))
-      result |= FE_INVALID;
-
-  return result;
+  return fenv_reg_to_exceptions (fe.l);
 }
 weak_alias (__fegetexcept, fegetexcept)