[Assorted-commits] SF.net SVN: assorted: [426] hash-dist/trunk/src/HashDist.scala
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-02-15 02:28:54
|
Revision: 426 http://assorted.svn.sourceforge.net/assorted/?rev=426&view=rev Author: yangzhang Date: 2008-02-14 18:28:59 -0800 (Thu, 14 Feb 2008) Log Message: ----------- moved hash functions to scala commons Modified Paths: -------------- hash-dist/trunk/src/HashDist.scala Modified: hash-dist/trunk/src/HashDist.scala =================================================================== --- hash-dist/trunk/src/HashDist.scala 2008-02-15 02:28:31 UTC (rev 425) +++ hash-dist/trunk/src/HashDist.scala 2008-02-15 02:28:59 UTC (rev 426) @@ -3,40 +3,13 @@ import Control._ import Io._ import Tree._ +import Hash._ import scala.util._ object HashDist { /** - * From libstdc++ 4.1 __stl_hash_string. - */ - def hashStl(xs: Seq[Int]) = { - var h = 0 - for (x <- xs) h = 5 * h + x - h - } - - /** - * From Sun JDK6 String.hashCode. - */ - def hashJava(xs: Seq[Int]) = { - var h = 0 - for (x <- xs) h = 31 * h + x - h - } - - /** - * From http://www.cse.yorku.ca/~oz/hash.html. Not sure if this is correct, - * since Int is signed. - */ - def hashDjb2(xs: Seq[Int]) = { - var h = 5381 - for (x <- xs) h = ((h << 5) + h) + x - h - } - - /** * Hash function. */ type Hasher = Seq[Int] => Int This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |