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

Question: why have an u128 as the encoding_position #47

Open
rklaehn opened this issue Jan 28, 2023 · 0 comments
Open

Question: why have an u128 as the encoding_position #47

rklaehn opened this issue Jan 28, 2023 · 0 comments

Comments

@rklaehn
Copy link

rklaehn commented Jan 28, 2023

I have been reading the code, and there is one thing I am curious about. Why is the encoding_position an u128?

I mean - I get it. If you encode 2^64 bytes of data, the encoded length will be more than 2^64 bytes, and therefore you need an u128 to track the encoded position. But what good does that do you?

All file operations including seek, length etc. use u64. So as soon as your encoding is larger than 2^64, everything is broken anyway. Wouldn't it be better to do a checked addition whenever the result could exceed u64, and then just produce an error?

Just curious

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

1 participant