mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
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>
This commit is contained in:
parent
1c46937358
commit
9276a31c34
4 changed files with 42 additions and 51 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue