#include "som/som_operation.h"
#include "util/alloc.h"
#include "util/container.h"
+#include "util/hash.h"
#include "util/make_unique.h"
#include "util/ue2_containers.h"
#include <algorithm>
#include <array>
#include <vector>
+
#include <boost/functional/hash/hash_fwd.hpp>
+#include <boost/range/adaptor/map.hpp>
namespace ue2 {
virtual bool operator==(const RoseInstrType &) const { return true; }
size_t hash() const override {
- return Opcode;
+ return boost::hash_value(static_cast<int>(Opcode));
}
bool equiv_to(const RoseInstrType &, const RoseInstruction::OffsetMap &,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, groups);
- return v;
+ return hash_all(static_cast<int>(opcode), groups);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, min_offset);
- return v;
+ return hash_all(static_cast<int>(opcode), min_offset);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, groups);
- return v;
+ return hash_all(static_cast<int>(opcode), groups);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- return v;
+ return boost::hash_value(static_cast<int>(opcode));
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, min_bound);
- boost::hash_combine(v, max_bound);
- return v;
+ return hash_all(static_cast<int>(opcode), min_bound, max_bound);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, key);
- return v;
+ return hash_all(static_cast<int>(opcode), key);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, index);
- boost::hash_combine(v, count);
- return v;
+ return hash_all(static_cast<int>(opcode), index, count);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, and_mask);
- boost::hash_combine(v, cmp_mask);
- boost::hash_combine(v, neg_mask);
- boost::hash_combine(v, offset);
- return v;
+ return hash_all(static_cast<int>(opcode), and_mask, cmp_mask, neg_mask,
+ offset);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, and_mask);
- boost::hash_combine(v, cmp_mask);
- boost::hash_combine(v, neg_mask);
- boost::hash_combine(v, offset);
- return v;
+ return hash_all(static_cast<int>(opcode), and_mask, cmp_mask, neg_mask,
+ offset);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, and_mask);
- boost::hash_combine(v, cmp_mask);
- boost::hash_combine(v, negation);
- boost::hash_combine(v, offset);
- return v;
+ return hash_all(static_cast<int>(opcode), and_mask, cmp_mask, negation,
+ offset);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, queue);
- boost::hash_combine(v, lag);
- boost::hash_combine(v, report);
- return v;
+ return hash_all(static_cast<int>(opcode), queue, lag, report);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, queue);
- boost::hash_combine(v, lag);
- boost::hash_combine(v, report);
- return v;
+ return hash_all(static_cast<int>(opcode), queue, lag, report);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, delay);
- boost::hash_combine(v, index);
- return v;
+ return hash_all(static_cast<int>(opcode), delay, index);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, id);
- return v;
+ return hash_all(static_cast<int>(opcode), id);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, distance);
- return v;
+ return hash_all(static_cast<int>(opcode), distance);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, queue);
- boost::hash_combine(v, lag);
- return v;
+ return hash_all(static_cast<int>(opcode), queue, lag);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, som.type);
- boost::hash_combine(v, som.onmatch);
- return v;
+ return hash_all(static_cast<int>(opcode), som.type, som.onmatch);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, cancel);
- boost::hash_combine(v, queue);
- boost::hash_combine(v, event);
- return v;
+ return hash_all(static_cast<int>(opcode), cancel, queue, event);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, queue);
- boost::hash_combine(v, event);
- return v;
+ return hash_all(static_cast<int>(opcode), queue, event);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, quash_som);
- boost::hash_combine(v, dkey);
- boost::hash_combine(v, offset_adjust);
- return v;
+ return hash_all(static_cast<int>(opcode), quash_som, dkey,
+ offset_adjust);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, quash_som);
- boost::hash_combine(v, dkey);
- boost::hash_combine(v, offset_adjust);
- return v;
+ return hash_all(static_cast<int>(opcode), quash_som, dkey,
+ offset_adjust);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, event);
- boost::hash_combine(v, top_squash_distance);
- return v;
+ return hash_all(static_cast<int>(opcode), event, top_squash_distance);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, som.type);
- boost::hash_combine(v, som.onmatch);
- return v;
+ return hash_all(static_cast<int>(opcode), som.type, som.onmatch);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, som.type);
- boost::hash_combine(v, som.onmatch);
- return v;
+ return hash_all(static_cast<int>(opcode), som.type, som.onmatch);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, onmatch);
- boost::hash_combine(v, offset_adjust);
- return v;
+ return hash_all(static_cast<int>(opcode), onmatch, offset_adjust);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, onmatch);
- boost::hash_combine(v, offset_adjust);
- boost::hash_combine(v, ekey);
- return v;
+ return hash_all(static_cast<int>(opcode), onmatch, offset_adjust, ekey);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, onmatch);
- boost::hash_combine(v, offset_adjust);
- return v;
+ return hash_all(static_cast<int>(opcode), onmatch, offset_adjust);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, onmatch);
- boost::hash_combine(v, offset_adjust);
- boost::hash_combine(v, ekey);
- return v;
+ return hash_all(static_cast<int>(opcode), onmatch, offset_adjust, ekey);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, quash_som);
- boost::hash_combine(v, dkey);
- boost::hash_combine(v, onmatch);
- boost::hash_combine(v, offset_adjust);
- return v;
+ return hash_all(static_cast<int>(opcode), quash_som, dkey, onmatch,
+ offset_adjust);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, onmatch);
- boost::hash_combine(v, offset_adjust);
- return v;
+ return hash_all(static_cast<int>(opcode), onmatch, offset_adjust);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, ekey);
- return v;
+ return hash_all(static_cast<int>(opcode), ekey);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, end_adj);
- boost::hash_combine(v, min_length);
- return v;
+ return hash_all(static_cast<int>(opcode), end_adj, min_length);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, index);
- return v;
+ return hash_all(static_cast<int>(opcode), index);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, groups);
- return v;
+ return hash_all(static_cast<int>(opcode), groups);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, groups);
- return v;
+ return hash_all(static_cast<int>(opcode), groups);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, index);
- return v;
+ return hash_all(static_cast<int>(opcode), index);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, num_keys);
- for (const auto &jump : jump_table) {
- boost::hash_combine(v, jump.first);
+ size_t v = hash_all(static_cast<int>(opcode), num_keys);
+ for (const u32 &key : jump_table | boost::adaptors::map_keys) {
+ boost::hash_combine(v, key);
}
return v;
}
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, state);
- return v;
+ return hash_all(static_cast<int>(opcode), state);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, num_keys);
- boost::hash_combine(v, keys);
- return v;
+ return hash_all(static_cast<int>(opcode), num_keys, keys);
}
void write(void *dest, RoseEngineBlob &blob,
}
size_t hash() const override {
- size_t v = opcode;
- boost::hash_combine(v, iter_offset);
- return v;
+ return hash_all(static_cast<int>(opcode), iter_offset);
}
void write(void *dest, RoseEngineBlob &blob,