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~