danicoin/src/Transfers/TypeHelpers.h

31 lines
801 B
C
Raw Normal View History

// Copyright (c) 2011-2016 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
2014-06-25 17:21:42 +00:00
#pragma once
#include "ITransaction.h"
#include <functional>
#include <cstring>
2014-06-25 17:21:42 +00:00
namespace CryptoNote {
2015-07-30 15:22:07 +00:00
inline bool operator==(const AccountPublicAddress &_v1, const AccountPublicAddress &_v2) {
return memcmp(&_v1, &_v2, sizeof(AccountPublicAddress)) == 0;
}
}
namespace std {
template<>
2015-07-30 15:22:07 +00:00
struct hash < CryptoNote::AccountPublicAddress > {
size_t operator()(const CryptoNote::AccountPublicAddress& val) const {
size_t spend = *(reinterpret_cast<const size_t*>(&val.spendPublicKey));
size_t view = *(reinterpret_cast<const size_t*>(&val.viewPublicKey));
return spend ^ view;
}
};
}