-
Notifications
You must be signed in to change notification settings - Fork 63
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
Large numbers in object tree #21
Comments
I believe that's limitation of JavaScript, as it effectively does not support 64-bit integers :( |
Yes, that should the problem in this case, but it's solved for the converter pane. |
Generally, web IDE just runs JavaScript generated by KS compiler, so there's not much that web IDE can do about it — we need to solve it on code generation level. One of the options is to rely on 3rd party big integer library: for example, web IDE uses Peter Olson's BigInteger.js. However, there is no universal standard as well... |
I would split this problem into two parts:
Possible solutions for parsing onlyWe could make the JS runtime extensible by either accepting an optional interface which can handle parsing BigInteger from an Uint8Array (Kaitai would do the other endianness / bit magic), or either by wrapping the current KaitaiStream and overwrite the read[SU]8[lb]e, readBits methods. I like the first method a bit better: although it is less optimal performance-wise (especially if we have to copy bits into a custom array in readBits before calling the BigInteger parser), it would make much easier for our users to put Kaitai into their already existing solution and I think these are rare operations generally. In contrast for the second method we don't have to modify the runtime, but have to reimplement some of its features (like readBits) for our specific BigInteger library which probably won't work with an other implementations. Solution for expressionsAs far as I know there is no operator overloading, it is not even planned for newer JS versions. So if we want to use operations on big integers, we have to generate code like I don't know @GreyCat how hard this modification would be compiler-wise? |
@cugu I saw you'd like to use Kaitai in Go. You might want to join the conversion in this issue: kaitai-io/kaitai_struct#146 |
Duplicate of kaitai-io/kaitai_struct#183 |
Larger values are displayed incorrectly in the object tree pane. The converter pane shows them correctly.
The screenshot shows a selection of the bytes 0xbbbbbbbbaaaaaaaa as 0xbbbbbbbbaaaaa800 in the object tree.
The text was updated successfully, but these errors were encountered: