[vlc-devel] [PATCH 1/3] vlc_common.h: add helpers to get the upper rounded value of integer divisions
Steve Lhomme
robux4 at videolabs.io
Fri Mar 17 09:36:08 CET 2017
---
include/vlc_common.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/vlc_common.h b/include/vlc_common.h
index 6a75753dbf..b72dbfe689 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -507,6 +507,11 @@ struct vlc_common_members
/* clip v in [min, max] */
#define VLC_CLIP(v, min, max) __MIN(__MAX((v), (min)), (max))
+/* upper rounded value of the integer division */
+#define VLC_UPPER_DIV(v, div) (((v) + (div) - 1) / (div))
+/* upper modulo value of the integer */
+#define VLC_UPPER_MODULO(v, mod) (VLC_UPPER_DIV(v, mod) * mod)
+
VLC_USED
static inline int64_t GCD ( int64_t a, int64_t b )
{
--
2.11.1
More information about the vlc-devel
mailing list