| 175 | } |
| 176 | |
| 177 | size_t OperatorNodeBase::hash() const { |
| 178 | XXHash hstate; |
| 179 | hstate.update(m_input.data(), sizeof(m_input[0]) * m_input.size()); |
| 180 | size_t extra_size = 2 + m_config.comp_node().size() + m_extra_equiv_comp.size(), |
| 181 | next = 0, extra[extra_size]; |
| 182 | |
| 183 | // type info |
| 184 | extra[next++] = mgb::hash(dyn_typeinfo()); |
| 185 | |
| 186 | // config |
| 187 | extra[next++] = m_config.hash(); |
| 188 | for (auto i : m_config.comp_node()) |
| 189 | extra[next++] = mgb::hash(i); |
| 190 | |
| 191 | // extra |
| 192 | for (const HashableContainer& i : m_extra_equiv_comp) |
| 193 | extra[next++] = mgb::hash(i); |
| 194 | |
| 195 | mgb_assert(next == extra_size); |
| 196 | hstate.update(extra, sizeof(extra[0]) * extra_size); |
| 197 | return hstate.digest(); |
| 198 | } |
| 199 | |
| 200 | bool OperatorNodeBase::is_same_st(const Hashable& rhs_) const { |
| 201 | auto&& rhs = static_cast<const OperatorNodeBase&>(rhs_); |