utils: Use fixed-point arithmetic in qemu_strtosz
commit6567ba0c60d6e1366f7ac6e77665730e657e8eca
authorRichard Henderson <richard.henderson@linaro.org>
Mon, 15 Mar 2021 18:51:17 +0000 (15 12:51 -0600)
committerAlex Bennée <alex.bennee@linaro.org>
Wed, 17 Mar 2021 07:16:59 +0000 (17 07:16 +0000)
tree92abe05dedd247630a82e526bd28098873929736
parent5b7f5586d182b0cafb1f8d558992a14763e2953e
utils: Use fixed-point arithmetic in qemu_strtosz

Once we've parsed the fractional value, extract it into an integral
64-bit fraction.  Perform the scaling with integer arithmetic, and
simplify the overflow detection.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20210315185117.1986240-2-richard.henderson@linaro.org>
tests/unit/test-cutils.c
util/cutils.c