]> sourceware.org Git - glibc.git/commitdiff
Consolidate reduce_and_compute code
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Tue, 30 Aug 2016 07:21:39 +0000 (12:51 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Tue, 30 Aug 2016 07:21:39 +0000 (12:51 +0530)
This patch reshuffles the reduce_and_compute code so that the
structure matches other code structures of the same type elsewhere in
s_sin.c and s_sincos.c.  This is the beginning of an attempt to
consolidate and reduce code duplication in functions in s_sin.c to
make it easier to read and possibly also easier for the compiler to
optimize.

* sysdeps/ieee754/dbl-64/s_sin.c (reduce_and_compute):
Consolidate switch cases 0 and 2.

ChangeLog
sysdeps/ieee754/dbl-64/s_sin.c

index 73b2ed0e5e3320a4423048931c9e0b9d47b098b1..dec058d7a6654e476e0ebb887517432dd33b74c2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-08-30  Siddhesh Poyarekar  <siddhesh@sourceware.org>
+
+       * sysdeps/ieee754/dbl-64/s_sin.c (reduce_and_compute):
+       Consolidate switch cases 0 and 2.
+
 2016-08-29  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
 
        * math/Makefile (libm-gen-calls): Add cpow, clog, clog10, cexp, cproj.
index 7c9a07990f7154cfe010481ff5bd387153f7e289..e1ee7a980b4ea36aab6ca1299bc10861c6c94b86 100644 (file)
@@ -249,23 +249,20 @@ reduce_and_compute (double x, unsigned int k)
   k = (n + k) % 4;
   switch (k)
     {
-      case 0:
-       if (a * a < 0.01588)
-         retval = bsloww (a, da, x, n);
-       else
-         retval = bsloww1 (a, da, x, n);
-       break;
-      case 2:
-       if (a * a < 0.01588)
-         retval = bsloww (-a, -da, x, n);
-       else
-         retval = bsloww1 (-a, -da, x, n);
-       break;
-
-      case 1:
-      case 3:
-       retval = bsloww2 (a, da, x, n);
-       break;
+    case 2:
+      a = -a;
+      da = -da;
+    case 0:
+      if (a * a < 0.01588)
+       retval = bsloww (a, da, x, n);
+      else
+       retval = bsloww1 (a, da, x, n);
+      break;
+
+    case 1:
+    case 3:
+      retval = bsloww2 (a, da, x, n);
+      break;
     }
   return retval;
 }
This page took 0.156401 seconds and 5 git commands to generate.