Skip to content
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

Implement wat-numeric-values proposal #28

Merged
merged 1 commit into from
Nov 16, 2020
Merged

Implement wat-numeric-values proposal #28

merged 1 commit into from
Nov 16, 2020

Conversation

binji
Copy link
Member

@binji binji commented Nov 16, 2020

The proposal adds support to the text format for numeric data values,
e.g.:

(data
  (i32 1 2 3 4)
  (f32 1.0 1.5))

The current proposal doesn't specify how SIMD values would be encoded,
so this implementation uses this syntax:

(data
  (v128
    i32x4 0 0 0 0
    f64x2 1.0 1.5))

The proposal adds support to the text format for numeric data values,
e.g.:

```
(data
  (i32 1 2 3 4)
  (f32 1.0 1.5))
```

The current proposal doesn't specify how SIMD values would be encoded,
so this implementation uses this syntax:

```
(data
  (v128
    i32x4 0 0 0 0
    f64x2 1.0 1.5))
```
@binji binji requested a review from sbc100 November 16, 2020 16:29
@@ -625,7 +661,7 @@ struct Memory {
MemoryDesc desc;
OptAt<InlineImport> import;
InlineExportList exports;
optional<TextList> data;
optional<DataItemList> data;
Copy link
Member

Choose a reason for hiding this comment

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

Why not just use the empty list here to signify no items?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've been trying to use optional for things like this, rather than sentinel values. It makes it nicer to do a quick "does this exist" check too (data.has_value()) -- otherwise you'd probably need a separate function.

@binji
Copy link
Member Author

binji commented Nov 16, 2020

FYI: @echamudi

@binji binji merged commit abe2b58 into master Nov 16, 2020
@binji binji deleted the wat-numeric-values branch November 16, 2020 17:11
@echamudi
Copy link

@binji Thanks for the implementation.

The v128 syntax looks good to me! I'll incorporate it in the proposal.

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