mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 17:15:33 +00:00
fmt: fuzz, remove some unnecessary busywork
Removing some signed checks and logic where we've already guaranteed the values to be positive. Indeed, in these cases, if a negative value got through (per my realisation in the signed fuzz harness), it would cause an infinite loop due to flooring division.
This commit is contained in:
parent
2ae551c0af
commit
3571bf2c2d
4 changed files with 55 additions and 20 deletions
|
@ -680,8 +680,8 @@ std::string Fmt::render() const
|
|||
if (absvalue.is_fully_zero())
|
||||
buf += '0';
|
||||
while (!absvalue.is_fully_zero()) {
|
||||
buf += '0' + RTLIL::const_mod(absvalue, 10, part.signed_, false, 4).as_int();
|
||||
absvalue = RTLIL::const_div(absvalue, 10, part.signed_, false, absvalue.size());
|
||||
buf += '0' + RTLIL::const_mod(absvalue, 10, false, false, 4).as_int();
|
||||
absvalue = RTLIL::const_div(absvalue, 10, false, false, absvalue.size());
|
||||
}
|
||||
if (negative || part.plus)
|
||||
buf += negative ? '-' : '+';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue