|
From: | Richard Henderson |
Subject: | Re: [RFC PATCH] include/qemu/host-utils: Remove the *_overflow wrappers |
Date: | Thu, 23 Jun 2022 14:29:55 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
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~
[Prev in Thread] | Current Thread | [Next in Thread] |