confio / decode_raw

A protobuf debugging tool or protoc --decode_raw on steroids.
Apache License 2.0
10 stars 2 forks source link

Split EntryValue::Int in Fixed64/Fixed32/Varint #4

Closed webmaster128 closed 2 years ago

webmaster128 commented 2 years ago

With this extra information we can show fixed64/32 different than varints.

Here you see the unisgned / signed / float interpretation in yellow:

Bildschirmfoto 2022-02-11 um 16 46 21
konsumer commented 2 years ago

This looks rad. I think exponent notation (like 3.7e-201 or whatever) might make the long floats easier to read and maybe NaN should be filtered. There are more guesses for numbers too, like in a certain range, it could be a date, or if it's 0/1 it could be boolean, but those could be left unsaid.

webmaster128 commented 2 years ago

True, much guessing could be done from here. But the important step is to preserve the information instead of showing everything as integers.

In the last commit I changed the values to [u8; 8] and [u8; 4], which are fixed length byte arrays of 8 and bytes. This should be much better 1. to avoid interpreting them too early as unsigned int and 2. to pass them to JS without loosing information. Maybe this helps to interprete them later without a bigint library: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array