mirror of
https://github.com/YosysHQ/yosys
synced 2025-05-10 17:25:49 +00:00
kernel: handle unsigned case for as_int_saturating correctly
* This fixes #5105
This commit is contained in:
parent
af933b4f38
commit
e2485000c7
1 changed files with 3 additions and 0 deletions
|
@ -396,6 +396,9 @@ std::optional<int> RTLIL::Const::try_as_int(bool is_signed) const
|
||||||
int RTLIL::Const::as_int_saturating(bool is_signed) const
|
int RTLIL::Const::as_int_saturating(bool is_signed) const
|
||||||
{
|
{
|
||||||
if (!convertible_to_int(is_signed)) {
|
if (!convertible_to_int(is_signed)) {
|
||||||
|
if (!is_signed)
|
||||||
|
return std::numeric_limits<int>::max();
|
||||||
|
|
||||||
const auto min_size = get_min_size(is_signed);
|
const auto min_size = get_min_size(is_signed);
|
||||||
log_assert(min_size > 0);
|
log_assert(min_size > 0);
|
||||||
const auto neg = get_bits().at(min_size - 1);
|
const auto neg = get_bits().at(min_size - 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue