1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-11 04:28:58 +00:00

Fixed code that was causing the failing test.

This commit is contained in:
Thomas Harte 2016-11-19 19:55:30 +08:00
parent be60eaa120
commit a4c7b00ecd

View File

@ -139,25 +139,15 @@ uint8_t *ArrayBuilder::Buffer::reget_storage(size_t &size)
void ArrayBuilder::Buffer::flush() void ArrayBuilder::Buffer::flush()
{ {
if(allocated_data > submitted_data)
{
flushed_data = allocated_data;
return;
}
if(submitted_data) if(submitted_data)
{ {
memcpy(data.data(), &data[flushed_data], allocated_data - flushed_data); memcpy(data.data(), &data[submitted_data], allocated_data - submitted_data);
allocated_data -= flushed_data; allocated_data -= submitted_data;
flushed_data = allocated_data; flushed_data -= submitted_data;
submitted_data = 0;
}
else
{
allocated_data = 0;
flushed_data = 0;
submitted_data = 0; submitted_data = 0;
} }
flushed_data = allocated_data;
} }
size_t ArrayBuilder::Buffer::submit(bool is_input) size_t ArrayBuilder::Buffer::submit(bool is_input)