Updates from BitShares FC #22

Closed
nathanielhourt wants to merge 693 commits from dapp-support into latest-fc
Showing only changes of commit 55e2abe7d5 - Show all commits

View file

@ -49,13 +49,9 @@ hash160::operator string()const { return str(); }
char* hash160::data()const { return (char*)&_hash[0]; }
class hash160::encoder::impl {
public:
impl()
{
}
public:
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,32 +104,38 @@ 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;
}
void to_variant( const hash160& bi, variant& v, uint32_t max_depth )
{
void to_variant( const hash160& bi, variant& v, uint32_t max_depth )
{
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 )
{
}
void from_variant( const variant& v, hash160& bi, uint32_t max_depth )
{
std::vector<char> ve = v.as< std::vector<char> >( max_depth );
memset( &bi, char(0), sizeof(bi) );
if( ve.size() )
memcpy( &bi, ve.data(), std::min<size_t>(ve.size(),sizeof(bi)) );
}
}
} // fc