mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Optimize SHAMapItem construction
This commit is contained in:
committed by
Scott Schurr
parent
7ed2094a6a
commit
d8aab5a749
@@ -138,6 +138,7 @@ public:
|
||||
bool hasItem (uint256 const& id) const;
|
||||
bool delItem (uint256 const& id);
|
||||
bool addItem (SHAMapItem const& i, bool isTransaction, bool hasMeta);
|
||||
bool addItem (SHAMapItem&& i, bool isTransaction, bool hasMeta);
|
||||
uint256 getHash () const;
|
||||
|
||||
// save a copy if you have a temporary anyway
|
||||
|
||||
@@ -40,6 +40,7 @@ private:
|
||||
public:
|
||||
SHAMapItem (uint256 const& tag, Blob const & data);
|
||||
SHAMapItem (uint256 const& tag, Serializer const& s);
|
||||
SHAMapItem (uint256 const& tag, Serializer&& s);
|
||||
|
||||
Slice slice() const;
|
||||
|
||||
|
||||
@@ -798,6 +798,13 @@ bool SHAMap::addItem (const SHAMapItem& i, bool isTransaction, bool hasMetaData)
|
||||
return addGiveItem(std::make_shared<SHAMapItem const>(i), isTransaction, hasMetaData);
|
||||
}
|
||||
|
||||
bool
|
||||
SHAMap::addItem(SHAMapItem&& i, bool isTransaction, bool hasMetaData)
|
||||
{
|
||||
return addGiveItem(std::make_shared<SHAMapItem const>(std::move(i)),
|
||||
isTransaction, hasMetaData);
|
||||
}
|
||||
|
||||
uint256
|
||||
SHAMap::getHash () const
|
||||
{
|
||||
|
||||
@@ -37,4 +37,10 @@ SHAMapItem::SHAMapItem (uint256 const& tag, const Serializer& data)
|
||||
{
|
||||
}
|
||||
|
||||
SHAMapItem::SHAMapItem (uint256 const& tag, Serializer&& data)
|
||||
: tag_ (tag)
|
||||
, data_(std::move(data.modData()))
|
||||
{
|
||||
}
|
||||
|
||||
} // ripple
|
||||
|
||||
Reference in New Issue
Block a user