summaryrefslogtreecommitdiffstats
path: root/mpvcore
diff options
context:
space:
mode:
Diffstat (limited to 'mpvcore')
-rw-r--r--mpvcore/mp_common.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/mpvcore/mp_common.h b/mpvcore/mp_common.h
index ee2f055807..543c22073e 100644
--- a/mpvcore/mp_common.h
+++ b/mpvcore/mp_common.h
@@ -40,6 +40,10 @@
do { type SWAP_tmp = b; b = a; a = SWAP_tmp; } while (0)
#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
+// align must be a power of two (align >= 1), x >= 0
+#define MP_ALIGN_UP(x, align) (((x) + (align) - 1) & ~((align) - 1))
+#define MP_ALIGN_DOWN(x, align) ((x) & ~((align) - 1))
+
#define CONTROL_OK 1
#define CONTROL_TRUE 1
#define CONTROL_FALSE 0