qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH] include/qemu/host-utils: Remove the *_overflow wrappers


From: Peter Maydell
Subject: Re: [RFC PATCH] include/qemu/host-utils: Remove the *_overflow wrappers
Date: Thu, 23 Jun 2022 20:30:24 +0100

On Thu, 23 Jun 2022 at 17:41, Thomas Huth <thuth@redhat.com> wrote:
>
> According to commit cec07c0b612975 these wrappers were required
> for GCC < 5.0 and Clang < 3.8. We don't support such old compilers
> at all anymore, so we can remove the wrappers now.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  Not sure whether it's nicer to remove these to get rid of some lines
>  of code, or whether it's nicer to keep them for the more explicit names...
>
>  include/qemu/host-utils.h    | 235 +----------------------------------
>  accel/tcg/tcg-runtime-gvec.c |  16 +--
>  fpu/softfloat.c              |  10 +-
>  libdecnumber/decNumber.c     |   4 +-
>  target/arm/mve_helper.c      |  18 +--
>  5 files changed, 29 insertions(+), 254 deletions(-)
>
> diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h
> index bc743f5e32..6224815629 100644
> --- a/include/qemu/host-utils.h
> +++ b/include/qemu/host-utils.h
> @@ -366,231 +366,6 @@ static inline uint64_t uabs64(int64_t v)
>      return v < 0 ? -v : v;
>  }
>
> -/**
> - * sadd32_overflow - addition with overflow indication
> - * @x, @y: addends
> - * @ret: Output for sum
> - *
> - * Computes *@ret = @x + @y, and returns true if and only if that
> - * value has been truncated.
> - */
> -static inline bool sadd32_overflow(int32_t x, int32_t y, int32_t *ret)
> -{
> -#if __has_builtin(__builtin_add_overflow) || __GNUC__ >= 5
> -    return __builtin_add_overflow(x, y, ret);
> -#else
> -    *ret = x + y;
> -    return ((*ret ^ x) & ~(x ^ y)) < 0;
> -#endif
> -}

I think I'd prefer to keep the wrapper functions and just delete
the fallback ifdeffery, but I guess I don't feel really strongly
about it. Richard, do you have an opinion?

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]