diff --git a/include/verilated_funcs.h b/include/verilated_funcs.h index 2bb4ee4e1..eed3c1120 100644 --- a/include/verilated_funcs.h +++ b/include/verilated_funcs.h @@ -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(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; } diff --git a/include/verilated_types.h b/include/verilated_types.h index 08a6b93bb..0b5c4a822 100644 --- a/include/verilated_types.h +++ b/include/verilated_types.h @@ -91,12 +91,8 @@ struct VlWide final { // one. // OPERATOR METHODS - // Default copy assignment operators are used. bool operator==(const VlWide& 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& that) const VL_PURE { return !(*this == that); } operator bool() const VL_PURE {