[PR #226] [CLOSED] Binary search in Log2Floor #815

Open
opened 2026-01-29 20:51:03 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/google/brotli/pull/226
Author: @Nicoshev11
Created: 10/13/2015
Status: Closed

Base: masterHead: master


📝 Commits (1)

  • 5e59adf [decode.c] use binary search in Log2Floor

📊 Changes

1 file changed (+25 additions, -1 deletions)

View changed files

📝 dec/decode.c (+25 -1)

📄 Description

[decode.c] use binary search in Log2Floor

Log2Floor implementation uses lineal search to find the floor of the log2, doing a binary search is slightly faster.

Because Log2Floor is only called from ReadHuffmanCode and the parameter passed is always less than 1024, l16_Log2Floor does a binary search in the lower 16 bits of the number, thus, in only 3 loops it gets the result


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/google/brotli/pull/226 **Author:** [@Nicoshev11](https://github.com/Nicoshev11) **Created:** 10/13/2015 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`5e59adf`](https://github.com/google/brotli/commit/5e59adfc309cf5eb05c5bc63d497137cff880e94) [decode.c] use binary search in Log2Floor ### 📊 Changes **1 file changed** (+25 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `dec/decode.c` (+25 -1) </details> ### 📄 Description [decode.c] use binary search in Log2Floor Log2Floor implementation uses lineal search to find the floor of the log2, doing a binary search is slightly faster. Because Log2Floor is only called from ReadHuffmanCode and the parameter passed is always less than 1024, l16_Log2Floor does a binary search in the lower 16 bits of the number, thus, in only 3 loops it gets the result --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 20:51:03 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#815