mirror of
https://github.com/azahar-emu/sirit.git
synced 2026-04-08 10:57:12 +02:00
Revert "operand: Implement operand hashing and use hashed set for declarations"
This reverts commit 1e665afa36.
This commit is contained in:
16
src/op.cpp
16
src/op.cpp
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include <climits>
|
||||
|
||||
#include "common_types.h"
|
||||
#include "literal_number.h"
|
||||
@@ -48,21 +47,6 @@ bool Op::operator==(const Operand& other) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::size_t Op::Hash() const {
|
||||
std::size_t hash = Operand::Hash();
|
||||
hash ^= static_cast<std::size_t>(opcode) << 20;
|
||||
if (result_type) {
|
||||
hash ^= result_type->Hash() << 16;
|
||||
}
|
||||
hash ^= static_cast<std::size_t>(id.value_or(0)) << 8;
|
||||
std::size_t wrap = 32;
|
||||
for (const auto operand : operands) {
|
||||
wrap = (wrap + 7) % (sizeof(std::size_t) * CHAR_BIT);
|
||||
hash ^= operand->Hash() << wrap;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
void Op::Write(Stream& stream) const {
|
||||
stream.Write(static_cast<u16>(opcode));
|
||||
stream.Write(WordCount());
|
||||
|
||||
Reference in New Issue
Block a user