microsoft / vscode-hexeditor

VS Code Hex Editor
https://marketplace.visualstudio.com/items?itemName=ms-vscode.hexeditor
MIT License
523 stars 84 forks source link

[Feature request] Add in data inspector ULEB128 and SLEB128 #485

Closed jogo- closed 6 months ago

jogo- commented 6 months ago

Show in data inspector missing large integer formats as ULEB128 and LEB128 (Little Endian Base 128)

jogo- commented 6 months ago

🤔 Maybe using WASM based Little Endian Base 128 varint encoding / decoding, supporting the full (u)int64 range https://github.com/thi-ng/umbrella/tree/develop/packages/leb128

connor4312 commented 6 months ago

It should be easy enough to implement in plain JS/TS, their wasm library is nothing magic

jogo- commented 6 months ago

Decoding ULEB128 and LEB128 as a full 128 bit integers will be the biggest challenge, as the largest BigInt integer type is limited too. Number.MAX_SAFE_INTEGER = 9007199254740991 Number.MIN_SAFE_INTEGER = -9007199254740991 Or I could try first to decode ULEB128 and LEB128 as sets of up to 16 bytes. @connor4312 What is your opinion?

connor4312 commented 6 months ago

BigInt is an arbitrary precision integer type and is supported everywhere that VS Code runs