Optimize primitive runtime functions

These were a victim of recent refactor but are actually important
(#4733). It also helps in debug builds not to use -O0 memcpy/memset.
This commit is contained in:
Geza Lore 2026-05-23 21:19:53 +01:00
parent f0c569ab0d
commit bd4bd82d4b
2 changed files with 4 additions and 8 deletions

View File

@ -376,17 +376,17 @@ std::string vl_timescaled_double(double value, const char* format = "%0.0f%s") V
VL_ATTR_ALWINLINE
static WDataOutP VL_MEMSET_ZERO_W(WDataOutP owp, int words) VL_MT_SAFE {
for (size_t i = 0; i < words; ++i) owp[i] = 0;
std::memset(owp.datap(), 0, words * sizeof(EData));
return owp;
}
VL_ATTR_ALWINLINE
static WDataOutP VL_MEMSET_ONES_W(WDataOutP owp, int words) VL_MT_SAFE {
for (size_t i = 0; i < words; ++i) owp[i] = ~static_cast<EData>(0);
std::memset(owp.datap(), 0xff, words * sizeof(EData));
return owp;
}
VL_ATTR_ALWINLINE
static WDataOutP VL_MEMCPY_W(WDataOutP owp, WDataInP const iwp, int words) VL_MT_SAFE {
for (size_t i = 0; i < words; ++i) owp[i] = iwp[i];
std::memcpy(owp.datap(), iwp.datap(), words * sizeof(EData));
return owp;
}

View File

@ -91,12 +91,8 @@ struct VlWide final {
// one.
// OPERATOR METHODS
// Default copy assignment operators are used.
bool operator==(const VlWide<N_Words>& that) const VL_PURE {
for (size_t i = 0; i < N_Words; ++i) {
if (m_storage[i] != that.m_storage[i]) return false;
}
return true;
return std::memcmp(m_storage, that.m_storage, N_Words * sizeof(EData)) == 0;
}
bool operator!=(const VlWide<N_Words>& that) const VL_PURE { return !(*this == that); }
operator bool() const VL_PURE {