diff options
Diffstat (limited to 'akregator/src/mk4storage/metakit/src/remap.cpp')
-rw-r--r-- | akregator/src/mk4storage/metakit/src/remap.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/akregator/src/mk4storage/metakit/src/remap.cpp b/akregator/src/mk4storage/metakit/src/remap.cpp index 9bc9b440..cc8175df 100644 --- a/akregator/src/mk4storage/metakit/src/remap.cpp +++ b/akregator/src/mk4storage/metakit/src/remap.cpp @@ -258,10 +258,10 @@ t4_i32 c4_HashViewer::CalcHash(c4_Cursor cursor_) const int c4_HashViewer::LookDict(t4_i32 hash_, c4_Cursor cursor_) const { - const unsigned int tqmask = _map.GetSize() - 2; + const unsigned int mask = _map.GetSize() - 2; /* We must come up with (i, incr) such that 0 <= i < _size and 0 < incr < _size and both are a function of hash */ - int i = tqmask & ~hash_; + int i = mask & ~hash_; /* We use ~hash_ instead of hash_, as degenerate hash functions, such as for ints <sigh>, can have lots of leading zeros. It's not really a performance risk, but better safe than sorry. */ @@ -272,14 +272,14 @@ int c4_HashViewer::LookDict(t4_i32 hash_, c4_Cursor cursor_) const /* Derive incr from hash_, just to make it more arbitrary. Note that incr must not be 0, or we will get into an infinite loop.*/ - unsigned incr = (hash_ ^ ((unsigned long) hash_ >> 3)) & tqmask; + unsigned incr = (hash_ ^ ((unsigned long) hash_ >> 3)) & mask; if (!incr) - incr = tqmask; + incr = mask; int poly = GetPoly(); for (;;) { - i = (i+incr) & tqmask; + i = (i+incr) & mask; if (IsUnused(i)) break; if (Hash(i) == hash_ && KeySame(Row(i), cursor_)) @@ -288,7 +288,7 @@ int c4_HashViewer::LookDict(t4_i32 hash_, c4_Cursor cursor_) const freeslot = i; /* Cycle through GF(2^n)-{0} */ incr = incr << 1; - if (incr > tqmask) + if (incr > mask) incr ^= poly; /* This will implicitely clear the highest bit */ } |