[Feature] support for c#'s 7bit int?
What feature would you like to see?
i would like to see c#'s binary reader 7 bit integer
How will this feature be useful to you and others?
i will be able to parse c# fields that use that number format
Request Type
- [x] I can provide a PoC for this feature or am willing to work on it myself and submit a PR
Additional context?
i am willing to work on this
I am assuming that you mean that the pattern language a binary reader to process this type of data. The pattern language has already a bit reader in std::mem::read_bits. You can also parse 7 bit integers easily using bit-fields. What exact functionality are you trying to use that you are having trouble with? If you can provide more details maybe it will be easier to determine if extra functionality is needed or not.
the 7 bit format is a dynamic size where the msb determines if another byte is read a related stack overflow question i am unsure on how to implement this into the Pattern editor as i am very new ImHex
Here is a partial implementation . Use the values in pragma example to create a sample input file for testing it.
#pragma example 56 78 86 99 95 87 58 88 57 78 78 00 00 00 00 00
import std.core;
import std.mem;
bitfield SevenBitBits {
value : 7;
bool keepReading : 1;
if (!keepReading || std::core::array_index() > 3 )
break;
};
struct SevenBitBytes {
SevenBitBits bytes[while(true)];
};
SevenBitBytes data[while(!std::mem::eof())]@0;