Skip to content

Implement binary encoder and decoder support#57

Open
titzer wants to merge 4 commits intomainfrom
encoder_impl
Open

Implement binary encoder and decoder support#57
titzer wants to merge 4 commits intomainfrom
encoder_impl

Conversation

@titzer
Copy link
Contributor

@titzer titzer commented Mar 12, 2026

@rossberg PTAL, thanks!

let has_paget = (flags land 8 = 8) in
let min = uN s in
let max = opt uN has_max s in
let ps = if has_paget then Int32.to_int(u32 s) else 16 in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I notice the cast, I think PageT should carry an int32. The abstract syntax usually tries to reflect value ranges as precisely as it can.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's getting to be annoying. Given that it's a log representation now, should we use something even tighter, like a byte (even though it's encoded as an LEB)?

let flags = flag (max <> None) 0 + flag (at = I64AT) 2 in
byte flags; u64 min; opt u64 max

let memorylimits at {min; max} (PageT ps) =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: Symmetrically here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't quite understand what this comment means.

titzer and others added 2 commits March 12, 2026 15:08
Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org>
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.

2 participants