1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-23 15:16:17 +00:00
Files
godot/core/io
Fabio Alessandrelli cbc772d696 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?
2019-12-22 15:35:44 +01:00
..
2019-09-25 10:28:50 +02:00
2019-06-21 00:14:42 +02:00
2019-01-01 12:58:10 +01:00
2019-09-05 09:48:36 +02:00
2019-09-25 23:45:32 +01:00
2019-07-08 09:18:46 +02:00
2019-01-01 12:58:10 +01:00
2019-05-19 13:10:35 +02:00