summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/macro.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/shared/macro.h b/src/shared/macro.h
index 79bee0396c..dfbc20142f 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -117,6 +117,13 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {
_a < _b ? _a : _b; \
})
+#define LESS_BY(A,B) \
+ __extension__ ({ \
+ typeof(A) _A = (A); \
+ typeof(B) _B = (B); \
+ _A > _B ? _A - _B : 0; \
+ })
+
#ifndef CLAMP
#define CLAMP(x, low, high) \
__extension__ ({ \