-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
i128 and u128 support #38482
i128 and u128 support #38482
Conversation
r? @eddyb |
(rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ |
📌 Commit 84fd6c3 has been approved by |
@bors r+ |
📌 Commit 1abfc5c has been approved by |
@bors p=100 (to avoid bitrotting) |
If you push to a PR branch while the PR is closed, github won't let you reopen it. You have to reopen it first, then push the new version. |
@retep998 yes, found that out after I've already pushed it. :/ |
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.
I read the diff out of curiosity and was surprised by this.
-0x0000_0000_0000_8000...0x0000_0000_0000_7fff => I16, | ||
-0x0000_0000_8000_0000...0x0000_0000_7fff_ffff => I32, | ||
-0x8000_0000_0000_0000...0x7fff_ffff_ffff_ffff => I64, | ||
_ => I128 |
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.
Match argument is an i64
there, I128
will never be returned.
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.
See #37900 (comment)
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.
Would it be better to actually add the "proper" case, but have the *128 case return a *64 instead, with a comment linking to the relevant issue?
0...0x0000_0000_0000_ffff => I16, | ||
0...0x0000_0000_ffff_ffff => I32, | ||
0...0xffff_ffff_ffff_ffff => I64, | ||
_ => I128, |
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.
Match argument is an u64
there, I128
will never be returned.
⌛ Testing commit 1abfc5c with merge 764d2f6... |
💔 Test failed - auto-mac-32-opt |
@bors: retry
…On Tue, Dec 20, 2016 at 9:41 AM, bors ***@***.***> wrote:
💔 Test failed - auto-mac-32-opt
<https://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/11397>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#38482 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAD95FjO7LrbLl3Ari1p96O-5GH0qgMpks5rKBNmgaJpZM4LRXRV>
.
|
@bors: r- Looking at some travis logs it looks like this doesn't compile on 32-bit maybe? I think the error is:
|
☔ The latest upstream changes (presumably #38499) made this pull request unmergeable. Please resolve the merge conflicts. |
Rebased. r? @eddyb |
@bors r+ |
📌 Commit 5b4fe10 has been approved by |
⌛ Testing commit 5b4fe10 with merge 1602354... |
💔 Test failed - auto-win-msvc-32-opt |
Ok, this seems like another windows ABI issue with the intrinsics, this time on 32 bit. I'm trying to reproduce the issue right now. Fixing the bug is a matter of finding out what LLVM expects as ABI in this case and replicating it in Rust. |
📌 Commit 29e01af has been approved by |
i128 and u128 support Brings i128 and u128 support to nightly rust, behind a feature flag. The goal of this PR is to do the bulk of the work for 128 bit integer support. Smaller but just as tricky features needed for stabilisation like 128 bit enum discriminants are left for future PRs. Rebased version of #37900, which in turn was a rebase + improvement of #35954 . Sadly I couldn't reopen #37900 due to github. There goes my premium position in the homu queue... [plugin-breaking-change] cc #35118 (tracking issue)
☀️ Test successful - status-appveyor, status-travis |
Awesome! |
wow, great!! 🎉 it was the FIRST TRYhttp://devopsreactions.tumblr.com/post/151057980189/getting-your-build-through-the-pipeline |
This passed on the first try in 2017! (in utc + (-3)..9 ). |
We introduced the unadjusted ABI to work around wrong (buggy) ABI expectations by LLVM on Windows [1]. Therefore, it should be solely used on Windows and not on other platforms, like right now is the case. [1]: see this comment for details rust-lang#38482 (comment)
…gisa Don't use "unadjusted" ABI on non windows platforms We introduced the unadjusted ABI to work around wrong (buggy) ABI expectations by LLVM on Windows [1]. Therefore, it should be solely used on Windows and not on other platforms, like right now is the case. [1]: see this comment for details rust-lang#38482 (comment)
…gisa Don't use "unadjusted" ABI on non windows platforms We introduced the unadjusted ABI to work around wrong (buggy) ABI expectations by LLVM on Windows [1]. Therefore, it should be solely used on Windows and not on other platforms, like right now is the case. [1]: see this comment for details rust-lang#38482 (comment)
…gisa Don't use "unadjusted" ABI on non windows platforms We introduced the unadjusted ABI to work around wrong (buggy) ABI expectations by LLVM on Windows [1]. Therefore, it should be solely used on Windows and not on other platforms, like right now is the case. [1]: see this comment for details rust-lang#38482 (comment)
As discussed bigint + u8 for decimal representation also avoiding the use of generics for the most part. For now the only imaginable way to have errors in my mind is decimal mismatch. Lots to fill in here and some open questions Do we want this in a separate crate? I imagine it is possible the eth-rpc crate may ultimately depend on this functionality. I just figured out that u128 is natively available in rust on all targets as LLVM has support for it rust simply exposes that. See [this pr](rust-lang/rust#38482) from late 2016. This has been [stablized in 1.26](https://blog.rust-lang.org/2018/05/10/Rust-1.26.html). The representable range here even with a token that is using 18 decimals of precision is 19 9s. If you have 10^19 of something I think it is alright to say that you need to do two transactions. I believe that u128 represents the best combination of speed flexibility and consistency. It is very unlikely to me that any token balance will natively overflow this representation.
Brings i128 and u128 support to nightly rust, behind a feature flag. The goal of this PR is to do the bulk of the work for 128 bit integer support. Smaller but just as tricky features needed for stabilisation like 128 bit enum discriminants are left for future PRs.
Rebased version of #37900, which in turn was a rebase + improvement of #35954 . Sadly I couldn't reopen #37900 due to github. There goes my premium position in the homu queue...
[plugin-breaking-change]
cc #35118 (tracking issue)