Bit level manipulation of buffers 😎
1:1 recreation of the buffer api for the bit level, includes all functions except len, create, tostring and fromstring, as there is no use for a bit level counterpart.
writeu and writei allows for widths ranging from 1 to 53. Writing an i53 doesn't use 2's compliment for the format, due to f64 precision issues.
If you want to use a combined byte/bit offset, you can merley use this idiv and mod to separate it when calling the function bitbuffer.writeu(b, offset // 8, offset % 8, value), the reason this isn't done internally is to allow for extra micro-optimization when using this module. Other ways to handle offsets are included here.
Can be installed with wally using arvidsilverlock/bitbuffer@latest
Changes since the previous version include:
- Inlining
writeuandreadufunctions when used internally (except forReaderandWriterclasses) - Inlining
IncrementOffsetwithinReaderandWriterclasses. - Removal of the localisation of
buffer.readcalls, this has no effect on performance. - Adding an
Offsetclass which handles your offset for you,ReaderandWriterinherit from this. - The
buffer,byteandbitvalues present inReaders andWriters are no longer considered private.