mirror of
https://github.com/azahar-emu/sirit.git
synced 2026-04-10 20:03:31 +02:00
operand: Implement operand hashing and use hashed set for declarations
Instead of manually searching each element in the declarations vector, use an unordered_set to emplace new declarations avoiding repetition.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include "common_types.h"
|
||||
#include "literal_string.h"
|
||||
@@ -36,4 +37,8 @@ bool LiteralString::operator==(const Operand& other) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::size_t LiteralString::Hash() const {
|
||||
return Operand::Hash() ^ std::hash<std::string>{}(string);
|
||||
}
|
||||
|
||||
} // namespace Sirit
|
||||
|
||||
Reference in New Issue
Block a user