3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-19 12:23:39 +00:00
This commit is contained in:
KrystalDelusion 2025-06-03 09:44:53 +12:00 committed by GitHub
commit 7bd3c3b4d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -512,8 +512,7 @@ std::string RTLIL::Const::decode_string() const
ch |= 1 << j; ch |= 1 << j;
} }
} }
if (ch != 0) s.append({ch});
s.append({ch});
} }
i -= 8; i -= 8;
for (; i >= 0; i -= 8) { for (; i >= 0; i -= 8) {
@ -523,10 +522,12 @@ std::string RTLIL::Const::decode_string() const
ch |= 1 << j; ch |= 1 << j;
} }
} }
if (ch != 0) s.append({ch});
s.append({ch});
} }
return s; auto first_char = s.find_first_not_of('\0');
if (first_char != std::string::npos)
return s.substr(first_char);
else return s;
} }
int RTLIL::Const::size() const { int RTLIL::Const::size() const {