aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/dbl-64/s_sin.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2016-08-30 12:51:39 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2016-08-30 12:51:39 +0530
commit32efd690bd9ab8cb55d185bf5b0a1a3c0e539120 (patch)
tree8603756e3dd981d57cdd6ac5fe42c80005f77c10 /sysdeps/ieee754/dbl-64/s_sin.c
parentfeb62ddacb7b1d772d7383de0228a3977f07fc1e (diff)
downloadglibc-32efd690bd9ab8cb55d185bf5b0a1a3c0e539120.zip
glibc-32efd690bd9ab8cb55d185bf5b0a1a3c0e539120.tar.gz
glibc-32efd690bd9ab8cb55d185bf5b0a1a3c0e539120.tar.bz2
Consolidate reduce_and_compute code
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.
Diffstat (limited to 'sysdeps/ieee754/dbl-64/s_sin.c')
-rw-r--r--sysdeps/ieee754/dbl-64/s_sin.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
index 7c9a079..e1ee7a9 100644
--- a/sysdeps/ieee754/dbl-64/s_sin.c
+++ b/sysdeps/ieee754/dbl-64/s_sin.c
@@ -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;
}