You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The use case here is that sometimes when dealing with leb128 you'll often have a scenario where a leb128 integer denotes how many bytes left in the region are part of a section or unit. When encoding, though, we often don't know the length of the section up-front, so a common trick is to do something like:
For a u32 encoded as leb128, reserve 5 bytes of space
Encode the entire section
Encode the length of the section into the previously reserved 5 bytes of space
This encoding uses the maximal instead of minimal width, using "padding zero bytes" that look like 0x80 to ensure that leb128 eats up all 5 of the bytes reserved.
It'd be neat if this crate supported such a use case (it's sort of like Seek with writers), although I'd be fine just supporting it with slices for the time being!
The text was updated successfully, but these errors were encountered:
This came up during rustwasm/walrus#30, specifically rustwasm/walrus#30 (comment).
The use case here is that sometimes when dealing with leb128 you'll often have a scenario where a leb128 integer denotes how many bytes left in the region are part of a section or unit. When encoding, though, we often don't know the length of the section up-front, so a common trick is to do something like:
This encoding uses the maximal instead of minimal width, using "padding zero bytes" that look like 0x80 to ensure that leb128 eats up all 5 of the bytes reserved.
It'd be neat if this crate supported such a use case (it's sort of like
Seek
with writers), although I'd be fine just supporting it with slices for the time being!The text was updated successfully, but these errors were encountered: