Skip to content

Commit

Permalink
Fix bug in BitWriter::WriteMultiple. (libjxl#4027)
Browse files Browse the repository at this point in the history
  • Loading branch information
veluca93 authored Dec 23, 2024
1 parent 24e12ba commit 4aeeb25
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/jxl/enc_fast_lossless.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ struct BitWriter {
this->bits_in_buffer += nbits[i];
// This `if` seems to be faster than using ternaries.
if (this->bits_in_buffer >= 64) {
uint64_t next_buffer = bits[i] >> shift;
uint64_t next_buffer = shift >= 64 ? 0 : bits[i] >> shift;
this->buffer = next_buffer;
this->bits_in_buffer -= 64;
this->bytes_written += 8;
Expand Down

0 comments on commit 4aeeb25

Please sign in to comment.