optimize out unnecessary allocation
This commit is contained in:
parent
4cc4d16fba
commit
28c7bba442
|
@ -73,8 +73,7 @@ void blob::iStream(std::shared_ptr<bufferstream> stream)
|
|||
auto length = stream->readType<int32_t>();
|
||||
value.resize(length);
|
||||
stream->read(value.data(), length);
|
||||
auto pad = length % 4;
|
||||
for (int i = 0; i < pad; i++)
|
||||
for (uint padding = length % 4; padding > 0; padding--)
|
||||
stream->readType<uint8_t>();
|
||||
}
|
||||
|
||||
|
@ -82,8 +81,7 @@ void blob::iStream(std::shared_ptr<bufferstream> stream)
|
|||
void blob::oStream(std::shared_ptr<bufferstream> stream) const
|
||||
{
|
||||
stream->writeType<int32_t>(value.size());
|
||||
auto pad = value.size() % 4;
|
||||
for (uint i = 0; i < pad; i++)
|
||||
for (uint padding = value.size() % 4; padding > 0; padding--)
|
||||
stream->readType<uint8_t>();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue