summaryrefslogtreecommitdiff
path: root/thirdparty
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2019-12-22 15:23:35 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2019-12-22 15:35:44 +0100
commitcbc772d696e0148f2788f3b78115c70296d6d34a (patch)
tree07a2e5422ab3d1eb93489ddda24db5c3c9457f79 /thirdparty
parent8938577459ba1f33a814833c06d92e775c04bb5e (diff)
Fix buffers size calculation in PacketPeerStream.
The calculation used to be wrong when exactly at a power of 2. `nearest_shift` always return the "next" power of 2 `nearest_shift(4) == 3 # 2^3 = 8`. On the other hand `next_power_of_2` returns the exact value if that value is a power of 2 (i.e. `next_power_of_2(4) == 4`). I.e. : ``` WARN_PRINT(itos(next_power_of_2(4)) + " " + itos(1 << nearest_shift(4))); // WARNING: ... : 4 8 ``` Is this by design?
Diffstat (limited to 'thirdparty')
0 files changed, 0 insertions, 0 deletions