We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am filing this issue as something to possibly consider for the future.
Currently struct is used for converting bytes to ints (and a few other values like floats, but this issue is only about ints):
https://github.com/kaitai-io/kaitai_struct_python_runtime/blob/master/kaitaistruct.py#L170
For ints Python 3 has a different mechanism for converting from byte strings to ints namely from_bytes():
from_bytes()
https://docs.python.org/3/library/stdtypes.html#int.from_bytes
What is very convenient is that it allows arbitrary length byte strings, so it becomes absolutely trivial to implement something like u3 or u5 or u11.
u3
u5
u11
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am filing this issue as something to possibly consider for the future.
Currently struct is used for converting bytes to ints (and a few other values like floats, but this issue is only about ints):
https://github.com/kaitai-io/kaitai_struct_python_runtime/blob/master/kaitaistruct.py#L170
For ints Python 3 has a different mechanism for converting from byte strings to ints namely
from_bytes()
:https://docs.python.org/3/library/stdtypes.html#int.from_bytes
What is very convenient is that it allows arbitrary length byte strings, so it becomes absolutely trivial to implement something like
u3
oru5
oru11
.The text was updated successfully, but these errors were encountered: