Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: gperf/src/gperf/3.0.1/gperf-3.0.1-src/lib/hash.cc

Issue 10804012: Add native Windows binary for gperf. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gperf/src/gperf/3.0.1/gperf-3.0.1-src/lib/hash.cc
===================================================================
--- gperf/src/gperf/3.0.1/gperf-3.0.1-src/lib/hash.cc (revision 0)
+++ gperf/src/gperf/3.0.1/gperf-3.0.1-src/lib/hash.cc (revision 0)
@@ -0,0 +1,27 @@
+/*
+Copyright (C) 1990, 2000, 2002 Free Software Foundation
+ written by Doug Lea <dl@rocky.oswego.edu>
+*/
+
+#include <hash.h>
+
+/*
+ Some useful hash function.
+ It's not a particularly good hash function (<< 5 would be better than << 4),
+ but people believe in it because it comes from Dragon book.
+*/
+
+unsigned int
+hashpjw (const unsigned char *x, unsigned int len) // From Dragon book, p436
+{
+ unsigned int h = 0;
+ unsigned int g;
+
+ for (; len > 0; len--)
+ {
+ h = (h << 4) + *x++;
+ if ((g = h & 0xf0000000) != 0)
+ h = (h ^ (g >> 24)) ^ g;
+ }
+ return h;
+}
Property changes on: gperf\src\gperf\3.0.1\gperf-3.0.1-src\lib\hash.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « gperf/src/gperf/3.0.1/gperf-3.0.1-src/lib/hash.h ('k') | gperf/src/gperf/3.0.1/gperf-3.0.1-src/mkinstalldirs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698