RE: [PATCH 02/19] host-utils: move abs64() to host-utils

2021-08-27 Thread Luis Fernando Fujita Pires
> >> Oh, I wasn't referring to any specific users. What I meant is that, > >> if we make abs64() generically available from host-utils, callers > >> could expect it to behave the same way as abs() in stdlib, for > >> example. > > > > That would be surprising, but do you think there are cases where

Re: [PATCH 02/19] host-utils: move abs64() to host-utils

2021-08-25 Thread Philippe Mathieu-Daudé
On 8/25/21 11:18 PM, Eduardo Habkost wrote: > On Wed, Aug 25, 2021 at 08:37:17PM +, Luis Fernando Fujita Pires wrote: >> From: Eduardo Habkost >> Right, that's true of any standard implementation of abs(). I thought about making it return uint64_t, but that could make it weird

Re: [PATCH 02/19] host-utils: move abs64() to host-utils

2021-08-25 Thread Eduardo Habkost
On Wed, Aug 25, 2021 at 08:37:17PM +, Luis Fernando Fujita Pires wrote: > From: Eduardo Habkost > > > > Right, that's true of any standard implementation of abs(). > > > I thought about making it return uint64_t, but that could make it > > > weird for other uses of abs64(), where callers

RE: [PATCH 02/19] host-utils: move abs64() to host-utils

2021-08-25 Thread Luis Fernando Fujita Pires
From: Eduardo Habkost > > Right, that's true of any standard implementation of abs(). > > I thought about making it return uint64_t, but that could make it > > weird for other uses of abs64(), where callers wouldn't expect a type > > change from int64_t to uint64_t. Maybe create a separate

Re: [PATCH 02/19] host-utils: move abs64() to host-utils

2021-08-25 Thread Eduardo Habkost
On Wed, Aug 25, 2021 at 12:48:35PM +, Luis Fernando Fujita Pires wrote: > From: David Gibson > > Hrm.. I'm a bit concerned about mkaing this a more widespread function, > > because it has a nasty edge case... which is basically unavoidable in an > > abs64() > > implementation.

RE: [PATCH 02/19] host-utils: move abs64() to host-utils

2021-08-25 Thread Luis Fernando Fujita Pires
From: David Gibson > Hrm.. I'm a bit concerned about mkaing this a more widespread function, > because it has a nasty edge case... which is basically unavoidable in an > abs64() > implementation. Specifically: > > abs64(0x800___0) == 0x800___ < 0 > > At least in the

Re: [PATCH 02/19] host-utils: move abs64() to host-utils

2021-08-24 Thread David Gibson
On Tue, Aug 24, 2021 at 11:27:13AM -0300, Luis Pires wrote: > Move abs64 to host-utils so it can be reused elsewhere. > Also made it inline. > > Signed-off-by: Luis Pires > --- > hw/i386/kvm/i8254.c | 5 - > include/qemu/host-utils.h | 8 > 2 files changed, 8 insertions(+), 5