stepcompress: Don't bother loop unrolling in push_sqrt()

It's not necessary to have two loops - checking if factor is greater
than zero in the loop is fine.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2016-11-14 15:36:11 -05:00
parent fd7cb99f47
commit 6ab269ceb7
1 changed files with 5 additions and 10 deletions

View File

@ -419,14 +419,9 @@ stepcompress_push_sqrt(struct stepcompress *sc, double steps, double step_offset
uint64_t *qn = sc->queue_next, *end = &qn[count]; uint64_t *qn = sc->queue_next, *end = &qn[count];
clock_offset += 0.5; clock_offset += 0.5;
double pos = step_offset + .5 + sqrt_offset/factor; double pos = step_offset + .5 + sqrt_offset/factor;
if (factor >= 0.0)
while (qn < end) { while (qn < end) {
*qn++ = clock_offset + safe_sqrt(pos*factor); double v = safe_sqrt(pos*factor);
pos += 1.0; *qn++ = clock_offset + (factor >= 0. ? v : -v);
}
else
while (qn < end) {
*qn++ = clock_offset - safe_sqrt(pos*factor);
pos += 1.0; pos += 1.0;
} }
sc->queue_next = qn; sc->queue_next = qn;