-
Notifications
You must be signed in to change notification settings - Fork 62
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
Clicking on boolean fields does not seek in the hex editor #130
Comments
|
Hmm... it does look like I misunderstood the type documentation then, I got tripped up because the
So, how do I specify a one-byte field interpreted as a boolean, is the enum actually the correct thing to do? I am still skeptical about the behavior where |
It depends. There are multiple ways to define a mapping from a byte to booleans. The most widespread one is the convention used in C: to consider
I don't understand what you mean. |
The Kaitai Struct doesn't have a built-in type for 1-byte booleans. This is in part because the format of byte-sized booleans can vary - usually 0 is false and 1 is true, but sometimes -1/0xff is used for true instead. The meaning of all other values also isn't clear - do other non-zero values also count as true, or do they generate an error? There are multiple ways to parse byte-sized booleans with KS. One option is to use meta:
bit-endian: be
seq:
- id: ignored
type: b7
valid: 0
- id: the_bool
type: b1 |
OK thanks for explaining. I think I should close this issue except maybe for the UI issue where clicking a bit integer field doesn't select the containing byte in the hex view. |
I'm seeing multiple issues with display and parsing of boolean (
b1
) fields.false
, even if the value is 1 (seeg
below)b
below)Using an enum with
0: false, 1: true
is a workaround.Included code, data and output below:
The text was updated successfully, but these errors were encountered: