mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2025-02-26 08:22:31 +00:00
bit_writer_c: fix copy_bits to be able to copy more than 64 bits
This commit is contained in:
parent
175f043ed1
commit
38c046eda3
@ -53,8 +53,14 @@ public:
|
||||
}
|
||||
|
||||
inline uint64_t copy_bits(std::size_t n, reader_c &src) {
|
||||
uint64_t value = src.get_bits(n);
|
||||
put_bits(n, value);
|
||||
uint64_t value{};
|
||||
|
||||
while (n) {
|
||||
auto to_copy = std::min<std::size_t>(n, 64);
|
||||
n -= to_copy;
|
||||
value = src.get_bits(to_copy);
|
||||
put_bits(to_copy, value);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user