spa: tweak SPA_MIN and SPA_MAX

This generates much better assembler because it can use a cmov in
more cases.
This commit is contained in:
Wim Taymans 2022-07-09 20:35:47 +02:00
parent fe7c6bcef9
commit 5fbda82cc3

View file

@ -131,13 +131,13 @@ struct spa_fraction {
({ \ ({ \
__typeof__(a) _min_a = (a); \ __typeof__(a) _min_a = (a); \
__typeof__(b) _min_b = (b); \ __typeof__(b) _min_b = (b); \
SPA_LIKELY(_min_a < _min_b) ? _min_a : _min_b; \ SPA_LIKELY(_min_a <= _min_b) ? _min_a : _min_b; \
}) })
#define SPA_MAX(a,b) \ #define SPA_MAX(a,b) \
({ \ ({ \
__typeof__(a) _max_a = (a); \ __typeof__(a) _max_a = (a); \
__typeof__(b) _max_b = (b); \ __typeof__(b) _max_b = (b); \
SPA_LIKELY(_max_a > _max_b) ? _max_a : _max_b; \ SPA_LIKELY(_max_a >= _max_b) ? _max_a : _max_b; \
}) })
#define SPA_CLAMP(v,low,high) \ #define SPA_CLAMP(v,low,high) \
({ \ ({ \