mirror of https://github.com/Desuuuu/klipper.git
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,14 +419,9 @@ stepcompress_push_sqrt(struct stepcompress *sc, double steps, double step_offset
|
|||
uint64_t *qn = sc->queue_next, *end = &qn[count];
|
||||
clock_offset += 0.5;
|
||||
double pos = step_offset + .5 + sqrt_offset/factor;
|
||||
if (factor >= 0.0)
|
||||
while (qn < end) {
|
||||
*qn++ = clock_offset + safe_sqrt(pos*factor);
|
||||
pos += 1.0;
|
||||
}
|
||||
else
|
||||
while (qn < end) {
|
||||
*qn++ = clock_offset - safe_sqrt(pos*factor);
|
||||
double v = safe_sqrt(pos*factor);
|
||||
*qn++ = clock_offset + (factor >= 0. ? v : -v);
|
||||
pos += 1.0;
|
||||
}
|
||||
sc->queue_next = qn;
|
||||
|
|
Loading…
Reference in New Issue