[erlang-bugs] erlang:phash2/1 isn't architecture-independent?
Scott Lystig Fritchie
fritchie@REDACTED
Sat Jan 26 02:32:18 CET 2008
Greetings.
Using R11B-5 on both i386 and amd64 platforms, I see that
erlang:phash2/1 yields different values. R12B-0 on amd64
agrees with R11B-5 on amd64. However, on both platforms,
erlang:phash/2 agree.
According to the R11B-5 docs for erlang:phash2/1:
"Portable hash function that will give the same hash for the same Erlang
term regardless of machine architecture and ERTS version (the BIF was
introduced in ERTS 5.2)."
So, is the bug in the source code or in the documentation? :-)
-Scott
3> os:cmd("uname -a").
"FreeBSD snookles.snookles.com 7.0-PRERELEASE FreeBSD 7.0-PRERELEASE #1: Sun Jan 13 13:51:57 CST 2008 root@REDACTED:/tank/exp/obj-fbsd7/tank/exp/src-fbsd7/sys/GENERIC amd64\n"
4> erlang:phash(<<"Scott9">>, 999999).
952273
5> erlang:phash2(<<"Scott9">>).
2589127136
-----------------
(dev@REDACTED)10> os:cmd("uname -a").
"FreeBSD old-snookles.snookles.com 5.4-STABLE FreeBSD 5.4-STABLE #0: Sat Sep 24 16:25:26 CDT 2005 fritchie@REDACTED:/scratch/freebsd-stable-obj/scratch/freebsd-stable-src/sys/GENERIC i386\n"
(dev@REDACTED)11> erlang:phash(<<"Scott9">>, 999999).
952273
(dev@REDACTED)12> erlang:phash2(<<"Scott9">>).
38990304
More information about the erlang-bugs
mailing list