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

string.pack can't handle longs #7

Closed
migeyel opened this issue Feb 14, 2024 · 0 comments
Closed

string.pack can't handle longs #7

migeyel opened this issue Feb 14, 2024 · 0 comments

Comments

@migeyel
Copy link
Contributor

migeyel commented Feb 14, 2024

Doing something like ("<I6"):pack(2 ^ 48 - 1) packs into the wrong output because the number gets cast into an int beforehand. Meanwhile, Cobalt casts their inputs into a 64-bit Java long, saturating if the value is too large, so it has the same issue for values larger than 2⁶⁴.

This issue isn't very frequent because most numbers are too small to come up into overflow territory, but since doubles can hold integers all the way over to 2⁵³, it's reasonable to expect to be able to pack these numbers too. Cobalt has some other peculiar choices of rounding, but I think implementing all of them would be too much to ask regardless.

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