LibGfx/WebPWriter: Use align_up_to()

No behavior change.
This commit is contained in:
Nico Weber 2024-06-16 13:07:04 -04:00
parent 8c7a0e6334
commit 1cc4d29d20

View file

@ -208,7 +208,7 @@ static ErrorOr<CanonicalCode> write_normal_code_lengths(LittleEndianOutputBitStr
// => length_nbits is at most 2 + 2*7 == 16
unsigned needed_length_nbits = encoded_lengths_count > 2 ? count_required_bits(encoded_lengths_count - 2) : 2;
VERIFY(needed_length_nbits <= 16);
needed_length_nbits = ceil_div(needed_length_nbits, 2) * 2;
needed_length_nbits = align_up_to(needed_length_nbits, 2);
TRY(bit_stream.write_bits((needed_length_nbits - 2) / 2, 3u));
TRY(bit_stream.write_bits(encoded_lengths_count - 2, needed_length_nbits));
}