mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 13:05:53 +00:00
Major rewrite of the SHAMap code. This code performs much better
than the original version, particularly for smaller maps.
This commit is contained in:
@@ -114,6 +114,40 @@ uint256 Serializer::get256(int offset) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Serializer::add1(unsigned char byte)
|
||||
{
|
||||
int ret=mData.size();
|
||||
mData.push_back(byte);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Serializer::get1(int& byte, int offset) const
|
||||
{
|
||||
if(offset>=mData.size()) return false;
|
||||
byte=mData[offset];
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Serializer::chop(int bytes)
|
||||
{
|
||||
if(bytes>mData.size()) return false;
|
||||
mData.resize(mData.size()-bytes);
|
||||
return true;
|
||||
}
|
||||
|
||||
int Serializer::removeLastByte()
|
||||
{
|
||||
int size=mData.size()-1;
|
||||
if(size<0)
|
||||
{
|
||||
assert(false);
|
||||
return -1;
|
||||
}
|
||||
int ret=mData[size];
|
||||
mData.resize(size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Serializer::getRaw(std::vector<unsigned char>& o, int offset, int length) const
|
||||
{
|
||||
if((offset+length)>mData.size()) return false;
|
||||
|
||||
Reference in New Issue
Block a user