FC Updates from BitShares and myself #21
1 changed files with 42 additions and 38 deletions
|
|
@ -49,13 +49,9 @@ hash160::operator string()const { return str(); }
|
|||
|
||||
char* hash160::data()const { return (char*)&_hash[0]; }
|
||||
|
||||
|
||||
class hash160::encoder::impl {
|
||||
public:
|
||||
impl()
|
||||
{
|
||||
}
|
||||
|
||||
impl() { }
|
||||
};
|
||||
|
||||
hash160::encoder::~encoder() {}
|
||||
|
|
@ -66,6 +62,7 @@ hash160 hash160::hash( const char* d, uint32_t dlen ) {
|
|||
e.write(d,dlen);
|
||||
return e.result();
|
||||
}
|
||||
|
||||
hash160 hash160::hash( const string& s ) {
|
||||
return hash( s.c_str(), s.size() );
|
||||
}
|
||||
|
|
@ -97,6 +94,7 @@ hash160 operator << ( const hash160& h1, uint32_t i ) {
|
|||
fc::detail::shift_l( h1.data(), result.data(), result.data_size(), i );
|
||||
return result;
|
||||
}
|
||||
|
||||
hash160 operator ^ ( const hash160& h1, const hash160& h2 ) {
|
||||
hash160 result;
|
||||
result._hash[0] = h1._hash[0].value() ^ h2._hash[0].value();
|
||||
|
|
@ -106,18 +104,23 @@ hash160 operator ^ ( const hash160& h1, const hash160& h2 ) {
|
|||
result._hash[4] = h1._hash[4].value() ^ h2._hash[4].value();
|
||||
return result;
|
||||
}
|
||||
|
||||
bool operator >= ( const hash160& h1, const hash160& h2 ) {
|
||||
return memcmp( h1._hash, h2._hash, sizeof(h1._hash) ) >= 0;
|
||||
}
|
||||
|
||||
bool operator > ( const hash160& h1, const hash160& h2 ) {
|
||||
return memcmp( h1._hash, h2._hash, sizeof(h1._hash) ) > 0;
|
||||
}
|
||||
|
||||
bool operator < ( const hash160& h1, const hash160& h2 ) {
|
||||
return memcmp( h1._hash, h2._hash, sizeof(h1._hash) ) < 0;
|
||||
}
|
||||
|
||||
bool operator != ( const hash160& h1, const hash160& h2 ) {
|
||||
return memcmp( h1._hash, h2._hash, sizeof(h1._hash) ) != 0;
|
||||
}
|
||||
|
||||
bool operator == ( const hash160& h1, const hash160& h2 ) {
|
||||
return memcmp( h1._hash, h2._hash, sizeof(h1._hash) ) == 0;
|
||||
}
|
||||
|
|
@ -126,6 +129,7 @@ bool operator == ( const hash160& h1, const hash160& h2 ) {
|
|||
{
|
||||
to_variant( std::vector<char>( (const char*)&bi, ((const char*)&bi) + sizeof(bi) ), v, max_depth );
|
||||
}
|
||||
|
||||
void from_variant( const variant& v, hash160& bi, uint32_t max_depth )
|
||||
{
|
||||
std::vector<char> ve = v.as< std::vector<char> >( max_depth );
|
||||
|
|
|
|||
Loading…
Reference in a new issue