dynarmic/src/frontend/ir/location_descriptor.h

54 lines
1.2 KiB
C
Raw Normal View History

/* This file is part of the dynarmic project.
* Copyright (c) 2016 MerryMage
* This software may be used and distributed according to the terms of the GNU
* General Public License version 2 or any later version.
*/
#pragma once
#include <functional>
#include <iosfwd>
2018-01-01 16:23:56 +01:00
#include "common/common_types.h"
namespace Dynarmic {
namespace IR {
class LocationDescriptor {
public:
2018-01-01 16:47:56 +01:00
explicit LocationDescriptor(u64 value) : value(value) {}
bool operator == (const LocationDescriptor& o) const {
2018-01-01 16:47:56 +01:00
return value == o.Value();
}
bool operator != (const LocationDescriptor& o) const {
return !operator==(o);
}
2018-01-01 16:47:56 +01:00
u64 Value() const { return value; }
private:
2018-01-01 16:23:56 +01:00
u64 value;
};
std::ostream& operator<<(std::ostream& o, const LocationDescriptor& descriptor);
2018-01-01 16:23:56 +01:00
} // namespace A32
} // namespace Dynarmic
namespace std {
template <>
struct less<Dynarmic::IR::LocationDescriptor> {
bool operator()(const Dynarmic::IR::LocationDescriptor& x, const Dynarmic::IR::LocationDescriptor& y) const {
2018-01-01 16:47:56 +01:00
return x.Value() < y.Value();
}
};
template <>
struct hash<Dynarmic::IR::LocationDescriptor> {
size_t operator()(const Dynarmic::IR::LocationDescriptor& x) const {
2018-01-01 16:47:56 +01:00
return std::hash<u64>()(x.Value());
}
};
} // namespace std