host-utils: introduce uabs64()
authorLuis Pires <luis.pires@eldorado.org.br>
Fri, 10 Sep 2021 11:26:05 +0000 (08:26 -0300)
committerDavid Gibson <david@gibson.dropbear.id.au>
Wed, 29 Sep 2021 09:37:38 +0000 (19:37 +1000)
commitd03bba0bfbe6dcacc9d7be2b664d70fde081cc47
tree341ef53a137c982ea064ed969b7287569190a7d8
parent4ff2a971f4dd533140c01607a0c776ba8d837bc7
host-utils: introduce uabs64()

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.

Signed-off-by: Luis Pires <luis.pires@eldorado.org.br>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20210910112624.72748-4-luis.pires@eldorado.org.br>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
include/qemu/host-utils.h