diff options
author | Marcelo Fernandez <marcelofg55@gmail.com> | 2017-08-17 18:35:55 -0300 |
---|---|---|
committer | Marcelo Fernandez <marcelofg55@gmail.com> | 2017-08-17 19:51:13 -0300 |
commit | eab850524ead092ed9fe22e57955e59eae373b79 (patch) | |
tree | 1ec2718c0810d852b51c4d40c135f4dde3841906 /core/io | |
parent | 33c1d25517050470689924c60414feaf295ce05f (diff) |
Add closest_power_of_2 func and implement mix_rate/latency on OS X
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/file_access_compressed.cpp | 20 | ||||
-rw-r--r-- | core/io/packet_peer.cpp | 4 |
2 files changed, 12 insertions, 12 deletions
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp index 4e802579c6..34bce3f04f 100644 --- a/core/io/file_access_compressed.cpp +++ b/core/io/file_access_compressed.cpp @@ -43,16 +43,16 @@ void FileAccessCompressed::configure(const String &p_magic, Compression::Mode p_ block_size = p_block_size; } -#define WRITE_FIT(m_bytes) \ - { \ - if (write_pos + (m_bytes) > write_max) { \ - write_max = write_pos + (m_bytes); \ - } \ - if (write_max > write_buffer_size) { \ - write_buffer_size = nearest_power_of_2(write_max); \ - buffer.resize(write_buffer_size); \ - write_ptr = buffer.ptr(); \ - } \ +#define WRITE_FIT(m_bytes) \ + { \ + if (write_pos + (m_bytes) > write_max) { \ + write_max = write_pos + (m_bytes); \ + } \ + if (write_max > write_buffer_size) { \ + write_buffer_size = next_power_of_2(write_max); \ + buffer.resize(write_buffer_size); \ + write_ptr = buffer.ptr(); \ + } \ } Error FileAccessCompressed::open_after_magic(FileAccess *p_base) { diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index f62ffd7183..66f8eea171 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -265,12 +265,12 @@ void PacketPeerStream::set_input_buffer_max_size(int p_max_size) { ERR_EXPLAIN("Buffer in use, resizing would cause loss of data"); ERR_FAIL_COND(ring_buffer.data_left()); ring_buffer.resize(nearest_shift(p_max_size + 4)); - input_buffer.resize(nearest_power_of_2(p_max_size + 4)); + input_buffer.resize(next_power_of_2(p_max_size + 4)); } void PacketPeerStream::set_output_buffer_max_size(int p_max_size) { - output_buffer.resize(nearest_power_of_2(p_max_size + 4)); + output_buffer.resize(next_power_of_2(p_max_size + 4)); } PacketPeerStream::PacketPeerStream() { |