-
Notifications
You must be signed in to change notification settings - Fork 8
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
Option to specify whether decimal integer fields are signed or unsigned #17
Comments
Thanks. Yes we need better output formats someday. The decimal part relies on JS interpretation of rules to apply, the limit here is 52 bit for an integer then. |
The code to rework is ("it's unsafe to output more than 32 bits in one call" -- we mostly knew this would crash and burn) Lines 106 to 122 in 457c32f
|
I'll check if this can be fixed using |
Numbers bigger than 31 bit are now fixed with 4df41e6 using multiplication by 2 instead of left-shift which is signed modulo 32. |
A signed decimal format (2's complement, only up to 32 bit width) has been added as "s" with 464fa1e |
We could want signed for larger field width, and for e.g. hex. |
Wow, that was quick! Looks good to me. Might be worth mentioning in the docs that if you want signed little endian interpretation, the < character must come between the s and the number of bits. So s<32d works but <s32d doesn't. I don't have any need to display signed hex values, and I think that would be an unusual thing to do. OTOH, interpreting 32-bit or 64-bit strings as IEEE floating point values may be needed some day. |
Oh, sorry, I thought about making signed a general modifier, e.g. I'll see about e.g. |
Ah OK, 's' replaces 'd' instead of being a modifier. That works! |
Float is now supported, an example in this BitBench. |
This is a great tool! I would like the option to specify whether a decimal value should be interpreted and displayed as a signed or an unsigned value. Currently it appears that a 16-bit decimal field is always interpreted as unsigned, whereas a 32-bit field is interpreted as signed. For example, this data:
displays:
258d2d22 00000001 0000000001 00000000 65535 00000000-1 00000000 00000000 0000000000 0000a7f3 08
The text was updated successfully, but these errors were encountered: