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
Miri: convert to/from apfloat instead of host floats #61673
Miri: convert to/from apfloat instead of host floats #61673
Changes from 4 commits
3836573
0803d75
0012af6
8316cec
de7bcca
2ad303e
8dfc8db
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.
Much nicer!
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.
Yeah, I love this. :) If only we had a similar trait for integers.
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.
All integer operations can be implemented with a runtime bitwidth
n
and anu128
to hold the value, though (maybei128
for signed).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.
Like, LLVM also has an
APInt
, not justAPFloat
, andAPFloat
usesAPInt
for the significand, but I didn't portAPInt
as its own thing, just added a bunch of functions, because of how relatively simple it is:rust/src/librustc_apfloat/ieee.rs
Lines 2287 to 2777 in ad3829f
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.
Hm, I feel like at least for the signed/unsigned distinction this will become ugly when done "untyped".
That "simple" thing you pointed to is still way more complicated than what we currently do for integers ops in CTFE.
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.
@RalfJung Yes, because it handles arbitrary-size integers, while you have only one "limb".
What you do is more or less what I mean.