-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 hashWangYi1 when nimvm result to 0 #15915
Conversation
What's the issue? |
For the code snippet above I am getting the following output:
I don't see issues here. Could you please explain? |
do you run it target js, the const will go to when nimvm branch ,it need result= , after adding it you still get a number differs from js runtime result. and you check CI tests all fails. I create a pr for issue this, please check #15933 |
I see it is the javascript backend is affected.
with fix I am getting:
It is still different but getting better. It needs to match though. |
The lower 32-bits do match (probably everyone knows, but bears mentioning - print the numbers in hex and you will see the lower 8 nibbles match). I 100% agree, though, that we should get the whole number matching. That JS hash is actually pretty slow and has its current definition specifically to match the C/C++ backends as much as possible. Also, while this |
Oh, wait..I just read my comment in the |
|
Hmm. The If matching is important then we could also mask the high bits to zero (just for the JS target and just in the |
haha , dont mind |
I believe |
resolve the problem mentioned there (`hash() == 0`) as well as to close nim-lang#15624
Close in favour of #15937 |
no need mention PR nim-lang#15915, fixed in nim-lang#15937
* Alternate PR to #15915 to resolve the problem mentioned there (`hash() == 0`) as well as to close #15624 * Address #15937 (comment) { though this was only a move from 2 copies to 3 copies. ;-) }
no need mention PR nim-lang#15915, fixed in nim-lang#15937
* Alternate PR to nim-lang#15915 to resolve the problem mentioned there (`hash() == 0`) as well as to close nim-lang#15624 * Address nim-lang#15937 (comment) { though this was only a move from 2 copies to 3 copies. ;-) }
* Alternate PR to nim-lang#15915 to resolve the problem mentioned there (`hash() == 0`) as well as to close nim-lang#15624 * Address nim-lang#15937 (comment) { though this was only a move from 2 copies to 3 copies. ;-) }
* test for issue nim-lang#15624 and PR nim-lang#15915 for patch nim-lang#13823 * Update thashes.nim no need mention PR nim-lang#15915, fixed in nim-lang#15937 * rebase to devel(issue maybe fixed), ignore ouputs * Apply suggestions from code review Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
* Alternate PR to nim-lang#15915 to resolve the problem mentioned there (`hash() == 0`) as well as to close nim-lang#15624 * Address nim-lang#15937 (comment) { though this was only a move from 2 copies to 3 copies. ;-) }
* Alternate PR to nim-lang#15915 to resolve the problem mentioned there (`hash() == 0`) as well as to close nim-lang#15624 * Address nim-lang#15937 (comment) { though this was only a move from 2 copies to 3 copies. ;-) }
* test for issue nim-lang#15624 and PR nim-lang#15915 for patch nim-lang#13823 * Update thashes.nim no need mention PR nim-lang#15915, fixed in nim-lang#15937 * rebase to devel(issue maybe fixed), ignore ouputs * Apply suggestions from code review Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
reason same as hiXorLo
run
nim js -r a.nim
code example: