Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: constant folding for arithmetic conversion operations #720
feat: constant folding for arithmetic conversion operations #720
Changes from 57 commits
bffed99
1a27d54
b84766b
8ee49da
520de7c
1d656d6
9398d9d
7b955a9
6cb3c62
0500624
8f554e0
215eb40
ff26546
64b9199
6d7d440
cdde503
114524c
a087fbc
07768b2
9a81260
658adf4
2c0e75b
dc7ff13
aa73ab2
a519f34
a7a4088
46075c2
df854e8
ba81e7b
09ce1c9
5a372c7
26bc5ff
b513ace
1348891
5a71f75
6fa7eb9
7381432
3bfda50
0e0411f
8e88f3e
dea6085
48eb430
41fa47a
ccf789e
0c060fb
4e24c28
4bca931
3193cdb
d0513c4
89f1827
4b6123e
9500803
2c6abc6
905ef01
a6928e0
6e36684
b0c686d
8f693ac
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if
f
is negative? Doesas u64
cause a panic?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as u64
maps all negative floats to 0, should I add a panic?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this is a can of worms. The spec for
trunc_u
currently says "Returns an error when the float is non-finite or cannot be exactly stored in N bits". This should probably say "cannot be exactly represented as au<N>
". But what we're doing here is rounding, which is much more forgiving. WASM seems to say that the result is undefined if the number is negative, but rounded otherwise, which makes me think we should change the definition oftrunc_{u,s}
in the spec.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds like this could be a follow up issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll make one.