You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ContextBuffer::new rounds its slot count up to a power of two so push can mask instead of divide. push then capped the live length with .min(self.slots.len()) — the rounded count — so the buffer retained up to the next power of two rather than the requested -B N. That is why -B 1/2/4/8 looked correct while -B 3 printed four lines.
Kept the power-of-two slot allocation (the mask in push/drain_iter depends on it) and stored the requested capacity separately to bound len.
$ printf '01\n...\n10\nMM\n' | grep -e MM -B 3
08
09
10
MM
Diffed -B and -C for N=1..8 against GNU grep on the issue's input: identical for every value. Added a regression test over N=3,5,6,7 — the non-power-of-two values, since the powers of two passed even with the bug.
Permit my rudeness but this is identical #69 and I find it funny in a sad way that both are the exact same type of wrong. Seriously, they're line-for-line identical, almost as if... it was written by the same entity.
This is precisely why I'm jaded of AI-authored PRs: There's just... no variety anymore. They're all perfectly predictable within stochastic bounds. Same inputs expected outputs. And amnesia is built in as a feature.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #66.
ContextBuffer::newrounds its slot count up to a power of two sopushcan mask instead of divide.pushthen capped the live length with.min(self.slots.len())— the rounded count — so the buffer retained up to the next power of two rather than the requested-B N. That is why-B 1/2/4/8looked correct while-B 3printed four lines.Kept the power-of-two slot allocation (the mask in
push/drain_iterdepends on it) and stored the requested capacity separately to boundlen.Diffed
-Band-Cfor N=1..8 against GNU grep on the issue's input: identical for every value. Added a regression test over N=3,5,6,7 — the non-power-of-two values, since the powers of two passed even with the bug.cargo test: 95 passed. clippy-D warningsandcargo fmt --checkclean.