2016-09-05 11:54:09 +01:00
|
|
|
/* 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
|
|
|
|
|
2018-01-14 13:50:29 +00:00
|
|
|
#include <functional>
|
2016-09-05 21:31:25 +01:00
|
|
|
#include <iosfwd>
|
2018-01-01 15:23:56 +00:00
|
|
|
|
2016-09-05 11:54:09 +01:00
|
|
|
#include "common/common_types.h"
|
|
|
|
|
2018-01-26 13:51:48 +00:00
|
|
|
namespace Dynarmic::IR {
|
2016-09-05 11:54:09 +01:00
|
|
|
|
|
|
|
class LocationDescriptor {
|
|
|
|
public:
|
2018-01-01 15:47:56 +00:00
|
|
|
explicit LocationDescriptor(u64 value) : value(value) {}
|
|
|
|
|
2016-09-05 11:54:09 +01:00
|
|
|
bool operator == (const LocationDescriptor& o) const {
|
2018-01-01 15:47:56 +00:00
|
|
|
return value == o.Value();
|
2016-09-05 11:54:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool operator != (const LocationDescriptor& o) const {
|
|
|
|
return !operator==(o);
|
|
|
|
}
|
|
|
|
|
2018-01-01 15:47:56 +00:00
|
|
|
u64 Value() const { return value; }
|
|
|
|
|
|
|
|
private:
|
2018-01-01 15:23:56 +00:00
|
|
|
u64 value;
|
2016-09-05 11:54:09 +01:00
|
|
|
};
|
|
|
|
|
2016-09-05 21:31:25 +01:00
|
|
|
std::ostream& operator<<(std::ostream& o, const LocationDescriptor& descriptor);
|
|
|
|
|
2018-01-26 13:51:48 +00:00
|
|
|
} // namespace Dynarmic::IR
|
2016-09-05 11:54:09 +01:00
|
|
|
|
|
|
|
namespace std {
|
|
|
|
template <>
|
2017-12-05 21:34:40 +00:00
|
|
|
struct less<Dynarmic::IR::LocationDescriptor> {
|
|
|
|
bool operator()(const Dynarmic::IR::LocationDescriptor& x, const Dynarmic::IR::LocationDescriptor& y) const {
|
2018-01-01 15:47:56 +00:00
|
|
|
return x.Value() < y.Value();
|
2017-12-05 21:34:40 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
template <>
|
2016-09-05 11:54:09 +01:00
|
|
|
struct hash<Dynarmic::IR::LocationDescriptor> {
|
|
|
|
size_t operator()(const Dynarmic::IR::LocationDescriptor& x) const {
|
2018-01-01 15:47:56 +00:00
|
|
|
return std::hash<u64>()(x.Value());
|
2016-09-05 11:54:09 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
} // namespace std
|