Skip to content

Clarify encoding of varuint32 values. #562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 27, 2016

Conversation

mbebenita
Copy link
Contributor

When encoding section sizes, tools will usually emit a patchable varuint32 value like 0xFFFFFFFF, reserving up to 5 bytes in the stream. Once the size is known, this is patched with the real size of the section which many not necessarily to take up 5 bytes, thus tools will need to encode leading zeros bytes. LEB128 supports this, but may be surprising to people writing decoders, hence this clarification.

@titzer
Copy link

titzer commented Feb 27, 2016

lgtm

jfbastien added a commit that referenced this pull request Feb 27, 2016
Clarify encoding of varuint32 values.
@jfbastien jfbastien merged commit d198d6b into WebAssembly:master Feb 27, 2016
@ghost
Copy link

ghost commented Feb 27, 2016

Could you please also consider making it clear that redundant leading zeros have not semantic meaning in wasm and are free to be stripped and canonicalized in the pipeline. For example a content optimizing tool in the pipeline feeding a mobile device etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants