diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-08-31 10:07:44 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-08-31 10:17:01 -0400 |
commit | 026b9c336ce6f219d9b3c695450acadb2192ce20 (patch) | |
tree | 3d34cad3d78fc724953dc365224a0855b86bfe9d /klippy/stepcompress.c | |
parent | 60c77fff0688aa14329f9da4fcad76a00c4d89fe (diff) | |
download | kutter-026b9c336ce6f219d9b3c695450acadb2192ce20.tar.gz kutter-026b9c336ce6f219d9b3c695450acadb2192ce20.tar.xz kutter-026b9c336ce6f219d9b3c695450acadb2192ce20.zip |
stepcompress: Minor performance tweaks for rpi
Invert the if conditional in queue_append() and change the order of
reads in minmax_point() - gcc on the rpi seems to do generate better
code this way.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/stepcompress.c')
-rw-r--r-- | klippy/stepcompress.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/klippy/stepcompress.c b/klippy/stepcompress.c index b4d2dc2a..c3f010b2 100644 --- a/klippy/stepcompress.c +++ b/klippy/stepcompress.c @@ -66,9 +66,8 @@ struct points { static inline struct points minmax_point(struct stepcompress *sc, uint32_t *pos) { - uint32_t lsc = sc->last_step_clock; + uint32_t lsc = sc->last_step_clock, point = *pos - lsc; uint32_t prevpoint = pos > sc->queue_pos ? *(pos-1) - lsc : 0; - uint32_t point = *pos - lsc; uint32_t max_error = (point - prevpoint) / 2; if (max_error > sc->max_error) max_error = sc->max_error; @@ -443,7 +442,7 @@ static inline int queue_append(struct queue_append *qa, double step_clock) { double rel_sc = step_clock + qa->clock_offset; - if (likely(qa->qnext < qa->qend && rel_sc < (double)CLOCK_DIFF_MAX)) { + if (likely(!(qa->qnext >= qa->qend || rel_sc >= (double)CLOCK_DIFF_MAX))) { *qa->qnext++ = qa->last_step_clock_32 + (uint32_t)rel_sc; return 0; } |