aboutsummaryrefslogtreecommitdiff
path: root/include/hw
diff options
context:
space:
mode:
authorLuis Pires <luis.pires@eldorado.org.br>2021-10-25 16:11:36 -0300
committerRichard Henderson <richard.henderson@linaro.org>2021-10-27 17:10:00 -0700
commit9276a31c3484ff236a958a1e2a38beefb0eb7ebb (patch)
treeb686698f674067c8bf3ba8db53ee160f06b5d2ed /include/hw
parent1c46937358fc27a9e446d08c877389ee84d6767d (diff)
downloadqemu-9276a31c3484ff236a958a1e2a38beefb0eb7ebb.zip
qemu-9276a31c3484ff236a958a1e2a38beefb0eb7ebb.tar.gz
qemu-9276a31c3484ff236a958a1e2a38beefb0eb7ebb.tar.bz2
host-utils: move checks out of divu128/divs128
In preparation for changing the divu128/divs128 implementations to allow for quotients larger than 64 bits, move the div-by-zero and overflow checks to the callers. Signed-off-by: Luis Pires <luis.pires@eldorado.org.br> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20211025191154.350831-2-luis.pires@eldorado.org.br> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include/hw')
-rw-r--r--include/hw/clock.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/hw/clock.h b/include/hw/clock.h
index 11f67fb..7443e6c 100644
--- a/include/hw/clock.h
+++ b/include/hw/clock.h
@@ -324,8 +324,9 @@ static inline uint64_t clock_ns_to_ticks(const Clock *clk, uint64_t ns)
return 0;
}
/*
- * Ignore divu128() return value as we've caught div-by-zero and don't
- * need different behaviour for overflow.
+ * BUG: when CONFIG_INT128 is not defined, the current implementation of
+ * divu128 does not return a valid truncated quotient, so the result will
+ * be wrong.
*/
divu128(&lo, &hi, clk->period);
return lo;