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>
This commit is contained in:
parent
60c77fff06
commit
026b9c336c
|
@ -66,9 +66,8 @@ struct points {
|
||||||
static inline struct points
|
static inline struct points
|
||||||
minmax_point(struct stepcompress *sc, uint32_t *pos)
|
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 prevpoint = pos > sc->queue_pos ? *(pos-1) - lsc : 0;
|
||||||
uint32_t point = *pos - lsc;
|
|
||||||
uint32_t max_error = (point - prevpoint) / 2;
|
uint32_t max_error = (point - prevpoint) / 2;
|
||||||
if (max_error > sc->max_error)
|
if (max_error > sc->max_error)
|
||||||
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)
|
queue_append(struct queue_append *qa, double step_clock)
|
||||||
{
|
{
|
||||||
double rel_sc = step_clock + qa->clock_offset;
|
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;
|
*qa->qnext++ = qa->last_step_clock_32 + (uint32_t)rel_sc;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue