Reorder VCD codes for better viewer packing.

This commit is contained in:
Wilson Snyder 2019-05-06 18:55:38 -04:00
parent c6650f88e1
commit a2a7021914
1 changed files with 15 additions and 8 deletions

View File

@ -134,17 +134,24 @@ private:
// cppcheck-suppress functionConst // cppcheck-suppress functionConst
void dumpDone(); void dumpDone();
inline void printCode(vluint32_t code) { inline void printCode(vluint32_t code) {
if (code>=(94*94*94)) *m_writep++ = static_cast<char>((code/94/94/94)%94+33); *m_writep++ = static_cast<char>('!' + code % 94);
if (code>=(94*94)) *m_writep++ = static_cast<char>((code/94/94)%94+33); code /= 94;
if (code>=(94)) *m_writep++ = static_cast<char>((code/94)%94+33); while (code) {
*m_writep++ = static_cast<char>((code)%94+33); code--;
*m_writep++ = static_cast<char>('!' + code % 94);
code /= 94;
}
} }
static std::string stringCode(vluint32_t code) VL_PURE { static std::string stringCode(vluint32_t code) VL_PURE {
std::string out; std::string out;
if (code>=(94*94*94)) out += static_cast<char>((code/94/94/94)%94+33); out += static_cast<char>('!' + code % 94);
if (code>=(94*94)) out += static_cast<char>((code/94/94)%94+33); code /= 94;
if (code>=(94)) out += static_cast<char>((code/94)%94+33); while (code) {
return out + static_cast<char>((code)%94+33); code--;
out += static_cast<char>('!' + code % 94);
code /= 94;
}
return out;
} }
// CONSTRUCTORS // CONSTRUCTORS