Unnecessary loop in BrotliWarmupBitReader #548

Closed
opened 2026-01-29 20:45:32 +00:00 by claunia · 2 comments
Owner

Originally created by @vax-r on GitHub (Sep 6, 2025).

Description

98a89b1563/c/dec/bit_reader.c (L49)

In the code section mentioned above, no matter the return is exectued within loop or not, it's going to return BROTLI_TRUE . Maybe we can consider remove the loop cause eventually it's going to be a BROTLI_TRUE.

I would like to send a PR if that's the case, or we do have special concerns at this point so the loop is a must ?

Originally created by @vax-r on GitHub (Sep 6, 2025). ## Description https://github.com/google/brotli/blob/98a89b1563c728c351c4d8b0b6390cadb9fa0391/c/dec/bit_reader.c#L49 In the code section mentioned above, no matter the return is exectued within loop or not, it's going to return `BROTLI_TRUE` . Maybe we can consider remove the loop cause eventually it's going to be a `BROTLI_TRUE`. I would like to send a PR if that's the case, or we do have special concerns at this point so the loop is a must ?
Author
Owner

@eustas commented on GitHub (Sep 10, 2025):

Loop is not unnecessary - it improves performance for some platforms. See comments around aligned_read_mask and BROTLI_UNALIGNED_READ_FAST.

@eustas commented on GitHub (Sep 10, 2025): Loop is not unnecessary - it improves performance for some platforms. See comments around `aligned_read_mask` and `BROTLI_UNALIGNED_READ_FAST`.
Author
Owner

@vax-r commented on GitHub (Sep 16, 2025):

Loop is not unnecessary - it improves performance for some platforms. See comments around aligned_read_mask and BROTLI_UNALIGNED_READ_FAST.

I see, thank you !

@vax-r commented on GitHub (Sep 16, 2025): > Loop is not unnecessary - it improves performance for some platforms. See comments around `aligned_read_mask` and `BROTLI_UNALIGNED_READ_FAST`. I see, thank you !
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#548