mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
macro: add PA_CLIP_SUB() for saturated subtraction
This commit is contained in:
parent
457b973ba6
commit
827ae07c1e
1 changed files with 11 additions and 0 deletions
|
|
@ -157,6 +157,17 @@ static inline size_t PA_PAGE_ALIGN(size_t l) {
|
|||
#define PA_ROUND_DOWN(a, b) (((a) / (b)) * (b))
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define PA_CLIP_SUB(a, b) \
|
||||
__extension__ ({ \
|
||||
typeof(a) _a = (a); \
|
||||
typeof(b) _b = (b); \
|
||||
_a > _b ? _a - _b : 0; \
|
||||
})
|
||||
#else
|
||||
#define PA_CLIP_SUB(a, b) ((a) > (b) ? (a) - (b) : 0)
|
||||
#endif
|
||||
|
||||
/* This type is not intended to be used in exported APIs! Use classic "int" there! */
|
||||
#ifdef HAVE_STD_BOOL
|
||||
typedef _Bool pa_bool_t;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue