qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>, Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [RFC PATCH] include/qemu/host-utils: Remove the *_overflow wrappers
Date: Thu, 23 Jun 2022 14:29:55 -0700	[thread overview]
Message-ID: <0a1ecd14-69a8-afc6-f74c-18d5abf2e4d0@linaro.org> (raw)
In-Reply-To: <CAFEAcA-k73D5fPfp5XnD2gtRO0pTXpAt_xTG51dGnzji+=NGqA@mail.gmail.com>

On 6/23/22 12:30, Peter Maydell wrote:
>> -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?

Likewise I don't feel strongly, but lean toward keeping the names.  I will point out that 
without these names, one has to track down the type of each argument to figure out what 
is, or is not, overflowing.


r~


  reply	other threads:[~2022-06-23 21:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23 16:40 [RFC PATCH] include/qemu/host-utils: Remove the *_overflow wrappers Thomas Huth
2022-06-23 19:30 ` Peter Maydell
2022-06-23 21:29   ` Richard Henderson [this message]
2022-06-24  5:40     ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0a1ecd14-69a8-afc6-f74c-18d5abf2e4d0@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).