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

Use int to represent webidl long type #20290

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Sep 19, 2023

The webidl long type is defined to be a 32-bit type:

https://webidl.spec.whatwg.org/#idl-long
https://webidl.spec.whatwg.org/#idl-unsigned-long

Using long on the native side works find for wasm32 but breaks under wasm64 where long is 64-bit. Using int instead means the type is the same under wasm32 and wasm64 which more accurately represents the html5/webidl type.

See #20276

@sbc100
Copy link
Collaborator Author

sbc100 commented Sep 19, 2023

As a follow up we might consider switch to double since there types were converted to number back in 2014, I believe in order to represent sub-pixel values: w3c/touch-events@006274f (w3c/pointerevents#107)

However that seems like a big change that could cause breakages, relatively risk-free change first to unblock wasm64.

Copy link
Member

@dschuff dschuff left a comment

Choose a reason for hiding this comment

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

Any particular reason not to just use int32_t? or do we not use stdint in html5.h?

ChangeLog.md Outdated Show resolved Hide resolved
@sbc100
Copy link
Collaborator Author

sbc100 commented Sep 19, 2023

Any particular reason not to just use int32_t? or do we not use stdint in html5.h?

Yeah we don't include that header there... although we could. I'm inclined to stick with this solution since its kind of minimal fix.

The webidl `long` type is defined to be a 32-bit type:

https://webidl.spec.whatwg.org/#idl-long
https://webidl.spec.whatwg.org/#idl-unsigned-long

Using `long` on the native side works find for wasm32 but breaks
under wasm64 where `long` is 64-bit.  Using `int` instead means the
type is the same under wasm32 and wasm64 which more accurately
represents the html5/webidl type.

See emscripten-core#20276
@sbc100 sbc100 merged commit e6f6fc5 into emscripten-core:main Sep 19, 2023
2 checks passed
jspanchu added a commit to jspanchu/emscripten that referenced this pull request Sep 19, 2023
jspanchu added a commit to jspanchu/emscripten that referenced this pull request Sep 19, 2023
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