Skip to content

ToLEB128

Name Mandatory Description Default Type
⬅️ Input The integer to encode. Int
Output ➡️ Outputs the LEB128 encoded byte array. Bytes
Signed No If the integer to encode/decode is signed and can be negative. false Bool

This shard encodes the input(a signed or unsigned integer) into a LEB128 encoded byte array.

Details

If an integer was encoded with ToLEB128 with Signed set to true, it can be decoded with FromLEB128 with Signed set to true and vice versa.

Consider the following example: -1000 | ToLEB128(Signed: false) | FromLEB128(Signed: true) This will throw an error because the input was not encoded with Signed set to true.