-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[web-sys] Incorrect codegen for unsigned long long
in IDBVersionChangeEvent
#1149
Comments
I don't know how this works in practice, since u64 isn't supported in ECMAScript. Maybe f64 is the correct type. But then why define something in webidl that can't be represented in js? |
Yup -> #1088 (comment) And because WebIDL was never meant to be coupled to JS AFAICT. |
To expand on this: WebIDL was intended to be language-agnostic (so it could be used in other languages, like Java). But in practice it is used almost exclusively with JS, so more recent WebIDL contains more JSisms. The |
Closing as invalid.
fn to_u64(x: f64) -> u64 {
if x < 0.0 || x > (u64::max_value() as f64) {
panic!("out of bounds")
}
// cast rounds towards 0
(x + 0.5) as u64
} EDIT This doesn't work. Instead I'm only going to support up to 2^(mantissa bits + 1) (See SO) |
@derekdreery As you found, the biggest integer in JS is It seems to me that a function like that would be a nice addition to wasm-bindgen, since converting from |
The webidl signature is
but the code in web-sys is
The
f64
should beu64
.The text was updated successfully, but these errors were encountered: