[vlc-devel] [PATCH 1/2] vlc_common: builtin overflow functions are supported since gcc 6
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Thu Nov 23 13:34:16 CET 2017
On Thu, Nov 23, 2017, at 09:16 AM, KO Myung-Hun wrote:
> ---
> include/vlc_common.h | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/include/vlc_common.h b/include/vlc_common.h
> index 925c15fc2e..a149fc2696 100644
> --- a/include/vlc_common.h
> +++ b/include/vlc_common.h
> @@ -653,7 +653,7 @@ static inline uint64_t (bswap64)(uint64_t x)
> /* Integer overflow */
> static inline bool uadd_overflow(unsigned a, unsigned b, unsigned *res)
> {
> -#if defined(__GNUC__) || defined(__clang__)
> +#if (defined(__GNUC__) && VLC_GCC_VERSION(5,0)) || defined(__clang__)
> return __builtin_uadd_overflow(a, b, res);
> #else
> *res = a + b;
> @@ -664,7 +664,7 @@ static inline bool uadd_overflow(unsigned a, unsigned
> b, unsigned *res)
> static inline bool uaddl_overflow(unsigned long a, unsigned long b,
> unsigned long *res)
> {
> -#if defined(__GNUC__) || defined(__clang__)
> +#if (defined(__GNUC__) && VLC_GCC_VERSION(5,0)) || defined(__clang__)
> return __builtin_uaddl_overflow(a, b, res);
> #else
> *res = a + b;
> @@ -675,7 +675,7 @@ static inline bool uaddl_overflow(unsigned long a,
> unsigned long b,
> static inline bool uaddll_overflow(unsigned long long a, unsigned long
> long b,
> unsigned long long *res)
> {
> -#if defined(__GNUC__) || defined(__clang__)
> +#if (defined(__GNUC__) && VLC_GCC_VERSION(5,0)) || defined(__clang__)
> return __builtin_uaddll_overflow(a, b, res);
> #else
> *res = a + b;
> @@ -710,7 +710,7 @@ static inline bool add_overflow(unsigned long long a,
> unsigned long long b,
>
> static inline bool umul_overflow(unsigned a, unsigned b, unsigned *res)
> {
> -#if defined(__GNUC__) || defined(__clang__)
> +#if (defined(__GNUC__) && VLC_GCC_VERSION(5,0)) || defined(__clang__)
> return __builtin_umul_overflow(a, b, res);
> #else
> *res = a * b;
> @@ -721,7 +721,7 @@ static inline bool umul_overflow(unsigned a, unsigned
> b, unsigned *res)
> static inline bool umull_overflow(unsigned long a, unsigned long b,
> unsigned long *res)
> {
> -#if defined(__GNUC__) || defined(__clang__)
> +#if (defined(__GNUC__) && VLC_GCC_VERSION(5,0)) || defined(__clang__)
> return __builtin_umull_overflow(a, b, res);
> #else
> *res = a * b;
> @@ -732,7 +732,7 @@ static inline bool umull_overflow(unsigned long a,
> unsigned long b,
> static inline bool umulll_overflow(unsigned long long a, unsigned long
> long b,
> unsigned long long *res)
> {
> -#if defined(__GNUC__) || defined(__clang__)
> +#if (defined(__GNUC__) && VLC_GCC_VERSION(5,0)) || defined(__clang__)
> return __builtin_umulll_overflow(a, b, res);
> #else
> *res = a * b;
> --
> 2.13.3
>
Hi,
I suppose the commit message should be "... since GCC 5" ?
Regards,
--
Hugo Beauzée-Luyssen
hugo at beauzee.fr
More information about the vlc-devel
mailing list