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:
parent
fd7cb99f47
commit
6ab269ceb7
|
@ -419,16 +419,11 @@ 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) {
|
double v = safe_sqrt(pos*factor);
|
||||||
*qn++ = clock_offset + safe_sqrt(pos*factor);
|
*qn++ = clock_offset + (factor >= 0. ? v : -v);
|
||||||
pos += 1.0;
|
pos += 1.0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
while (qn < end) {
|
|
||||||
*qn++ = clock_offset - safe_sqrt(pos*factor);
|
|
||||||
pos += 1.0;
|
|
||||||
}
|
|
||||||
sc->queue_next = qn;
|
sc->queue_next = qn;
|
||||||
return sdir ? count : -count;
|
return sdir ? count : -count;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue