-
Notifications
You must be signed in to change notification settings - Fork 7
Implement binary encoder and decoder support #57
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -285,6 +285,17 @@ let limits uN s = | |
| let max = opt uN has_max s in | ||
| at, {min; max} | ||
|
|
||
| let memorylimits uN s = | ||
| let flags = byte s in | ||
| require (flags land 0xf2 = 0) s (pos s - 1) "malformed limits flags"; | ||
| let has_max = (flags land 1 = 1) in | ||
| let at = if flags land 4 = 4 then I64AT else I32AT in | ||
| 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 | ||
|
||
| at, {min; max}, (PageT ps) | ||
titzer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| let tagtype s = | ||
| zero s; | ||
| TagT (typeuse idx s) | ||
|
|
@@ -295,8 +306,8 @@ let globaltype s = | |
| GlobalT (mut, t) | ||
|
|
||
| let memorytype s = | ||
| let at, lim = limits u64 s in | ||
| MemoryT (at, lim, PageT 16) (* TODO(custom-page-sizes) *) | ||
| let at, lim, pt = memorylimits u64 s in | ||
| MemoryT (at, lim, pt) | ||
|
|
||
| let tabletype s = | ||
| let t = reftype s in | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -187,14 +187,19 @@ struct | |
| 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) = | ||
|
||
| let flags = flag (max <> None) 0 + flag (at = I64AT) 2 + flag (ps <> 16) 3 in | ||
| let ps_opt = if ps <> 16 then Some (Int32.of_int ps) else None in | ||
| byte flags; u64 min; opt u64 max; opt u32 ps_opt | ||
|
|
||
| let tagtype = function | ||
| | TagT ut -> u32 0x00l; typeuse u32 ut | ||
|
|
||
| let globaltype = function | ||
| | GlobalT (mut, t) -> valtype t; mutability mut | ||
|
|
||
| let memorytype = function | ||
| | MemoryT (at, lim, pt) -> limits at lim (* TODO(custom-page-sizes) *) | ||
| | MemoryT (at, lim, pt) -> memorylimits at lim pt | ||
|
|
||
| let tabletype = function | ||
| | TableT (at, lim, t) -> reftype t; limits at lim | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.