[vlc-devel] [PATCH 1/3] vlc_common.h: add helpers to get the upper rounded value of integer divisions
Rémi Denis-Courmont
remi at remlab.net
Fri Mar 17 09:46:41 CET 2017
On March 17, 2017 4:36:08 PM GMT+08:00, Steve Lhomme <robux4 at videolabs.io> wrote:
>---
> 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
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
I don't like expansion-unsafe functional macros, TBH. They've bitten too many asses too many times, so to speak.
--
Rémi Denis-Courmont
More information about the vlc-devel
mailing list