New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return remaining cached value on unaligned error #1
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 2 2
Lines 153 153
=====================================
Hits 153 153
Continue to review full report at Codecov.
|
While this is a good idea in general, without knowing how many useful bits the result still contains despite the E.g. if the result is The case with The current behavior encourages conscious use of the bit reader: you have to know how many bits you're expecting. In some situations this may require you to encode this info into the stream. But at least you always know what to expect. For this reason, I tend not to include this modification as-is. What do you think? |
That's reasonable. I'll have to track the number of bits read in my read loop. I think the best solution is for ReadBits to return the number of bits read as well. |
This could be done (returning the number of read bits). But I would prefer to add a new method to keep backward compatibility, e.g.
Also if we're adding And if we're at it, similar methods could also be added to Do you think this is reasonable / needed? The API is minimal and clean right now. This would almost double the API methods. Of course we can opt to only add |
I think the additional methods makes the API less enjoyable. Considering this package is fairly small and most Go users are vendoring I think the API breakage is preferable. The fix for affected users is easy too: just adding a |
Hi, Just trying to weigh in a bit.
I use this library heavily. And I dont use vendoring. Just waiting for dep to stablise. |
Similar to
io.Reader
, thebitio.Reader
should return the partial value when it encounters an error.This change is