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

Unified Diff: Source/core/scripts/Hasher.pm

Issue 20652002: Fix trailing whitespace in scripts and misc. files (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Don't change literal diff. Created 7 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
« no previous file with comments | « Source/core/features.gypi ('k') | Source/core/scripts/InFilesCompiler.pm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/scripts/Hasher.pm
diff --git a/Source/core/scripts/Hasher.pm b/Source/core/scripts/Hasher.pm
index cb0d1937395805d9e9a87650877296671c47e6ce..05a43f54517e5ac57d671b09c72c5c6384e5425d 100644
--- a/Source/core/scripts/Hasher.pm
+++ b/Source/core/scripts/Hasher.pm
@@ -42,16 +42,16 @@ sub GenerateHashValue
# This hash is designed to work on 16-bit chunks at a time. But since the normal case
# (above) is to hash UTF-16 characters, we just treat the 8-bit chars as if they
# were 16-bit chunks, which should give matching results
-
+
my $EXP2_32 = 4294967296;
-
+
my $hash = 0x9e3779b9;
my $l = scalar @chars; #I wish this was in Ruby --- Maks
my $rem = $l & 1;
$l = $l >> 1;
-
+
my $s = 0;
-
+
# Main loop
for (; $l > 0; $l--) {
$hash += ord($chars[$s]);
@@ -61,14 +61,14 @@ sub GenerateHashValue
$hash += $hash >> 11;
$hash %= $EXP2_32;
}
-
+
# Handle end case
if ($rem != 0) {
$hash += ord($chars[$s]);
$hash ^= (leftShift($hash, 11)% $EXP2_32);
$hash += $hash >> 17;
}
-
+
# Force "avalanching" of final 127 bits
$hash ^= leftShift($hash, 3);
$hash += ($hash >> 5);
@@ -77,16 +77,16 @@ sub GenerateHashValue
$hash += ($hash >> 15);
$hash = $hash% $EXP2_32;
$hash ^= (leftShift($hash, 10)% $EXP2_32);
-
+
# Save 8 bits for StringImpl to use as flags.
$hash &= 0xffffff;
-
+
# This avoids ever returning a hash code of 0, since that is used to
# signal "hash not computed yet". Setting the high bit maintains
# reasonable fidelity to a hash code of 0 because it is likely to yield
# exactly 0 when hash lookup masks out the high bits.
$hash = (0x80000000 >> 8) if ($hash == 0);
-
+
return $hash;
}
« no previous file with comments | « Source/core/features.gypi ('k') | Source/core/scripts/InFilesCompiler.pm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698