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

[JS] Fix for Issue11475 #11868

Merged
merged 4 commits into from
Dec 12, 2024
Merged

Conversation

flashultra
Copy link
Contributor

The following code ( for JS target) will return the value ("low: 4041473819") as max Int for JS is 9007199254740991 .
After the fix the value should be "low: -253493477"
The max value for Int32 should be 2,147,483,647

var i:Int64 = Int64.make(0xF0E3FF1B, 0x00000000);
var mcr:Int64 = Int64.ushr(i, 32);
trace("mcr: "+mcr);
trace("high: "+mcr.high);
trace("low: "+mcr.low);

@Simn
Copy link
Member

Simn commented Dec 11, 2024

Please add a test for the case this fixes!

@flashultra
Copy link
Contributor Author

flashultra commented Dec 11, 2024

As python test fails, the correct way would be to use Int32.clamp , but that is a private method.
There are two possible solutions:

  1. Make a clamp public, so can call it in Int64
  2. Create a new clamp function in the Int64 class

@skial skial mentioned this pull request Dec 11, 2024
1 task
@Simn Simn merged commit 8b3e8a1 into HaxeFoundation:development Dec 12, 2024
7 checks passed
@flashultra flashultra deleted the issue11475 branch December 17, 2024 12:32
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.

2 participants