summaryrefslogtreecommitdiffstats
path: root/tests/qht-bench.c
diff options
context:
space:
mode:
authorRichard Henderson2020-06-17 22:13:09 +0200
committerPeter Maydell2020-06-19 19:29:11 +0200
commit06c4cc3660b366278bdc7bc8b6677032d7b1118c (patch)
tree499f20a96fdb397076f0754ebd318aea56608889 /tests/qht-bench.c
parentMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20200618' into staging (diff)
downloadqemu-06c4cc3660b366278bdc7bc8b6677032d7b1118c.tar.gz
qemu-06c4cc3660b366278bdc7bc8b6677032d7b1118c.tar.xz
qemu-06c4cc3660b366278bdc7bc8b6677032d7b1118c.zip
qht: Fix threshold rate calculation
tests/qht-bench.c:287:29: error: implicit conversion from 'unsigned long' to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Werror,-Wimplicit-int-float-conversion] *threshold = rate * UINT64_MAX; ~ ^~~~~~~~~~ Fix this by splitting the 64-bit constant into two halves, each of which is individually perfectly representable, the sum of which produces the correct arithmetic result. This is very likely just a sticking plaster over some underlying incorrect code, but it will suppress the warning for the moment. Cc: Emilio G. Cota <cota@braap.org> Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/qht-bench.c')
-rw-r--r--tests/qht-bench.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/qht-bench.c b/tests/qht-bench.c
index e3b512f26f..eb88a90137 100644
--- a/tests/qht-bench.c
+++ b/tests/qht-bench.c
@@ -284,7 +284,8 @@ static void do_threshold(double rate, uint64_t *threshold)
if (rate == 1.0) {
*threshold = UINT64_MAX;
} else {
- *threshold = rate * UINT64_MAX;
+ *threshold = (rate * 0xffff000000000000ull)
+ + (rate * 0x0000ffffffffffffull);
}
}