Skip to content
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

16-bit tags/flags #10

Closed
odzhan opened this issue Mar 19, 2020 · 1 comment
Closed

16-bit tags/flags #10

odzhan opened this issue Mar 19, 2020 · 1 comment

Comments

@odzhan
Copy link

odzhan commented Mar 19, 2020

Hello,

This compressor is awesome, so thanks for sharing your code. :)

Apologies in advance if this is not the right place to ask.

Is there any reason why you use 2 bytes for tags instead of 1?
I implemented the depacker in 96 bytes, but was thinking it could be smaller (not much of course) if smaller tags used.

@jibsen
Copy link
Owner

jibsen commented Mar 20, 2020

Thanks, happy to hear you like it!

I guess at the time because I used 8-bit tags in aPLib, and some of the other compression libraries at the time were moving to 32-bit tags to improve speed. I wanted something that could still be implemented in little code on 16-bit x86, so 16-bit tags were the compromise.

One nice thing about using 16 rather than 8 bits is that because the literal bytes are interleaved with the tag bits, it is not possible to "peek" many bits ahead, but having up to 16 bits allowed sometimes using the lookup table in the decoder for speed.

@odzhan odzhan closed this as completed Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants