mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-18 09:02:14 +11:00
🐎 Max size 0 optimizations
This commit is contained in:
parent
95bf549427
commit
dc74da6072
1 changed files with 26 additions and 13 deletions
|
|
@ -103,6 +103,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if constexpr (max_log_size)
|
||||||
|
{
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
Transaction temp(a_name, b_name, amount);
|
Transaction temp(a_name, b_name, amount);
|
||||||
|
|
@ -114,6 +116,7 @@ public:
|
||||||
b.log.AddTrans(std::move(temp2));
|
b.log.AddTrans(std::move(temp2));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
@ -169,6 +172,8 @@ public:
|
||||||
Json::Value GetLogs(const std::string &name, const std::string &attempt)
|
Json::Value GetLogs(const std::string &name, const std::string &attempt)
|
||||||
{
|
{
|
||||||
Json::Value res;
|
Json::Value res;
|
||||||
|
if constexpr (max_log_size)
|
||||||
|
{
|
||||||
if (!users.if_contains(name, [&res, &attempt](const User &u) {
|
if (!users.if_contains(name, [&res, &attempt](const User &u) {
|
||||||
if (u.password != XXH3_64bits(attempt.data(), attempt.size()))
|
if (u.password != XXH3_64bits(attempt.data(), attempt.size()))
|
||||||
{
|
{
|
||||||
|
|
@ -182,6 +187,7 @@ public:
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -226,9 +232,16 @@ public:
|
||||||
{
|
{
|
||||||
user_save.close();
|
user_save.close();
|
||||||
for (const auto &u : temp.getMemberNames())
|
for (const auto &u : temp.getMemberNames())
|
||||||
|
{
|
||||||
|
if constexpr(max_log_size)
|
||||||
|
{
|
||||||
|
users.try_emplace(u, temp[u]["balance"].asUInt(), std::move(temp[u]["password"].asUInt64()), std::move(temp[u]["log"]));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
users.try_emplace(u, temp[u]["balance"].asUInt(), std::move(temp[u]["password"].asUInt64()), std::move(temp[u]["log"]));
|
users.try_emplace(u, temp[u]["balance"].asUInt(), std::move(temp[u]["password"].asUInt64()), std::move(temp[u]["log"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} bank;
|
} bank;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue