mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
defs: add SPA_LIKELY to MIN/MAX/CLAMP macros
This commit is contained in:
parent
5ef6a5cc5a
commit
dbbcd3fdc4
1 changed files with 3 additions and 3 deletions
|
|
@ -90,20 +90,20 @@ struct spa_fraction {
|
|||
({ \
|
||||
__typeof__(a) _a = (a); \
|
||||
__typeof__(b) _b = (b); \
|
||||
_a < _b ? _a : _b; \
|
||||
SPA_LIKELY(_a < _b) ? _a : _b; \
|
||||
})
|
||||
#define SPA_MAX(a,b) \
|
||||
({ \
|
||||
__typeof__(a) _a = (a); \
|
||||
__typeof__(b) _b = (b); \
|
||||
_a > _b ? _a : _b; \
|
||||
SPA_LIKELY(_a > _b) ? _a : _b; \
|
||||
})
|
||||
#define SPA_CLAMP(v,low,high) \
|
||||
({ \
|
||||
__typeof__(v) _v = (v); \
|
||||
__typeof__(low) _low = (low); \
|
||||
__typeof__(high) _high = (high); \
|
||||
_v > _high ? _high : ( _v < _low ? _low : _v); \
|
||||
SPA_MIN(SPA_MAX(_v, _low), _high); \
|
||||
})
|
||||
|
||||
#define SPA_MEMBER(b,o,t) ((t*)((uint8_t*)(b) + (int)(o)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue