🐛 further bug fixes

This commit is contained in:
EntireTwix 2021-06-03 01:54:58 -07:00
parent 7cef01e650
commit a1988d3bd5
2 changed files with 6 additions and 2 deletions

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
.vscode .vscode
build build
config.json config.json
users.json

View file

@ -10,6 +10,10 @@ struct Log
uint32_t end = 0; uint32_t end = 0;
void AddTrans(Transaction &&v) void AddTrans(Transaction &&v)
{ {
if(data.size())
{
end += (end + 1 < max_log_size); //branchless
}
if (data.size() <= end + 1 && end + 1 < max_log_size) //if memory reserved is full if (data.size() <= end + 1 && end + 1 < max_log_size) //if memory reserved is full
{ {
if (data.size() + pre_log_size > max_log_size) if (data.size() + pre_log_size > max_log_size)
@ -26,7 +30,6 @@ struct Log
data[i] = std::move(data[i - 1]); data[i] = std::move(data[i - 1]);
} }
data[0] = std::move(v); data[0] = std::move(v);
end += (end + 1 < max_log_size); //branchless
} }
Json::Value Serialize() const Json::Value Serialize() const
{ {