mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-01-02 11:08:48 -05:00
spa: add SPA_ABS helper macro
This commit is contained in:
parent
23edb9ab2a
commit
1c3802bd82
1 changed files with 5 additions and 0 deletions
|
|
@ -120,6 +120,11 @@ struct spa_fraction {
|
||||||
#define SPA_FOR_EACH_ELEMENT(arr, ptr) \
|
#define SPA_FOR_EACH_ELEMENT(arr, ptr) \
|
||||||
for (ptr = arr; (void*)ptr < SPA_PTROFF(arr, sizeof(arr), void); ptr++)
|
for (ptr = arr; (void*)ptr < SPA_PTROFF(arr, sizeof(arr), void); ptr++)
|
||||||
|
|
||||||
|
#define SPA_ABS(a) \
|
||||||
|
({ \
|
||||||
|
__typeof__(a) _a = (a); \
|
||||||
|
SPA_LIKELY(_a >= 0) ? _a : -_a; \
|
||||||
|
})
|
||||||
#define SPA_MIN(a,b) \
|
#define SPA_MIN(a,b) \
|
||||||
({ \
|
({ \
|
||||||
__typeof__(a) _min_a = (a); \
|
__typeof__(a) _min_a = (a); \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue