qemu-ppc
[Top][All Lists]
Advanced

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

Re: [PATCH v3 03/22] host-utils: introduce uabs64()


From: Richard Henderson
Subject: Re: [PATCH v3 03/22] host-utils: introduce uabs64()
Date: Thu, 21 Oct 2021 13:04:44 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 9/10/21 4:26 AM, Luis Pires wrote:
Introduce uabs64(), a function that returns the absolute value of
a 64-bit int as an unsigned value. This avoids the undefined behavior
for common abs implementations, where abs of the most negative value is
undefined.

I do question the comment there wrt undefined. We compile with -fwrapv, which means that *no* overflow is undefined; we always have properly truncated twos-compliment values.


r~



reply via email to

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