Repository navigation
huff0: Allow building tables from histogram. - #1155
Conversation
Add interface to build tables from the histograms themselves. Adds direct method to export the current table and helpers for size reuse (also via histograms).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds table-building capabilities to the ChangesHuffman Table Building and Serialization
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@huff0/build_table.go`:
- Around line 66-73: The EstimateSize(hist *[256]uint32) int method (and the
companion probe API that also accepts hist *[256]uint32 around lines 86-92)
currently dereference and iterate hist without a nil guard; add an early nil
check in both functions and return the appropriate sentinel (for EstimateSize
return -1; for the probe API return false) before any iteration or access to
hist to avoid panics when callers pass nil.
- Around line 17-27: BuildCTable currently dereferences the pointer parameter
count (s.count = *count) without checking for nil; add a nil guard at the start
of BuildCTable to return a clear error (e.g., errors.New("huff0: nil count
passed to BuildCTable")) when count == nil before any dereference or use. Locate
the function BuildCTable and insert the check before s.count = *count (and
before any other use of count) so callers passing nil receive a proper error
instead of a panic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: c8610f78-59b3-4b57-9f35-3011db506c49
📒 Files selected for processing (2)
huff0/build_table.gohuff0/build_table_test.go
Add interface to build tables from the histograms themselves.
Adds direct method to export the current table and helpers for size reuse (also via histograms).
Summary by CodeRabbit
New Features
Tests