diff options
author | Luis Pires | 2021-10-25 21:11:36 +0200 |
---|---|---|
committer | Richard Henderson | 2021-10-28 02:10:00 +0200 |
commit | 9276a31c3484ff236a958a1e2a38beefb0eb7ebb (patch) | |
tree | b686698f674067c8bf3ba8db53ee160f06b5d2ed /include/hw/clock.h | |
parent | qemu/int128: Add int128_{not,xor} (diff) | |
download | qemu-9276a31c3484ff236a958a1e2a38beefb0eb7ebb.tar.gz qemu-9276a31c3484ff236a958a1e2a38beefb0eb7ebb.tar.xz qemu-9276a31c3484ff236a958a1e2a38beefb0eb7ebb.zip |
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/clock.h')
-rw-r--r-- | include/hw/clock.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/hw/clock.h b/include/hw/clock.h index 11f67fb970..7443e6c4ab 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; |