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

fix #16542 #16549

Merged
merged 16 commits into from
Jan 2, 2021
Merged

fix #16542 #16549

merged 16 commits into from
Jan 2, 2021

Conversation

ringabout
Copy link
Member

No description provided.

lib/pure/hashes.nim Outdated Show resolved Hide resolved
@ringabout
Copy link
Member Author

ringabout commented Jan 2, 2021

After this PR, hash(float) works both in JS and VM backend.

Notes that hash(float) never worked in JS backend. So I won't fix it in this PR. bigInt PR needs to be merged first.

  • In the next PR make a workaround for platforms doesn't support BigUint64Array
const buffer = new ArrayBuffer(8);
const floatBuffer = new Float64Array(buffer);
const uintBuffer = new Uint32Array(buffer);
floatBuffer[0] = x_503316698;
result_503316699 = uintBuffer[1];

see https://bugs.webkit.org/show_bug.cgi?id=190800

lib/pure/hashes.nim Outdated Show resolved Hide resolved
lib/pure/hashes.nim Outdated Show resolved Hide resolved
lib/pure/hashes.nim Outdated Show resolved Hide resolved
Copy link
Member

@timotheecour timotheecour left a comment

Choose a reason for hiding this comment

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

excellent

@Araq Araq added the merge_when_passes_CI mergeable once green label Jan 2, 2021
@Araq Araq merged commit d8b1ffc into nim-lang:devel Jan 2, 2021
@ringabout ringabout mentioned this pull request Jan 2, 2021
doAssert hash(234567.45) == -20468103
doAssert hash(-9999.283456) == -43247422
doAssert hash(84375674.0) == 707542256
doAssert hash(0.345602) != 0
Copy link
Member

Choose a reason for hiding this comment

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

weak test, doesn't check that
hash(x) == static(hash(x)) in this branch

mildred pushed a commit to mildred/Nim that referenced this pull request Jan 11, 2021
ardek66 pushed a commit to ardek66/Nim that referenced this pull request Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge_when_passes_CI mergeable once green
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants