summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2015-12-14 16:15:36 +0100
committerJulian Andres Klode <jak@debian.org>2015-12-14 16:16:56 +0100
commit6755060951828412e19e58afe5361f9ad06e5deb (patch)
treefd9ea43f3e31390a6b8217e2929aa5b9850bf782 /apt-pkg
parentd94233d865fd3e418ec4d9100741a1c4ba628533 (diff)
pkgcache: Make hash arch-independent using fixed size integer
This helps writing test cases. Also adapt the test case that expected 64-bit. Nothing changes performance wise, the distribution of the hash values remains intact.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/pkgcache.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index e65e37bca..23b75a640 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -203,7 +203,7 @@ bool pkgCache::ReMap(bool const &Errorchecks)
table (480 used items) */
map_id_t pkgCache::sHash(const string &Str) const
{
- unsigned long Hash = 0;
+ uint32_t Hash = 0;
for (string::const_iterator I = Str.begin(); I != Str.end(); ++I)
Hash = 41 * Hash + tolower_ascii(*I);
return Hash % HeaderP->GetHashTableSize();
@@ -211,7 +211,7 @@ map_id_t pkgCache::sHash(const string &Str) const
map_id_t pkgCache::sHash(const char *Str) const
{
- unsigned long Hash = tolower_ascii(*Str);
+ uint32_t Hash = tolower_ascii(*Str);
for (const char *I = Str + 1; *I != 0; ++I)
Hash = 41 * Hash + tolower_ascii(*I);
return Hash % HeaderP->GetHashTableSize();