mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Deal with unsigned integers in binary search.
This commit is contained in:
@@ -109,8 +109,10 @@ u32 CanonicalCode::read_symbol(InputBitStream& stream) const
|
||||
|
||||
for (;;) {
|
||||
code_bits = code_bits << 1 | stream.read_bits(1);
|
||||
ASSERT(code_bits < (1 << 16));
|
||||
|
||||
// FIXME: This seems really inefficient, this could be an index into an array instead.
|
||||
// FIXME: This is very inefficent and could greatly be improved by implementing this
|
||||
// algorithm: https://www.hanshq.net/zip.html#huffdec
|
||||
size_t index;
|
||||
if (AK::binary_search(m_symbol_codes.span(), code_bits, &index))
|
||||
return m_symbol_values[index];
|
||||
|
||||
Reference in New Issue
Block a user