mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-30 00:50:38 +08:00
fix documentation issue: #40
This commit is contained in:
Vendored
+1
-1
@@ -197,7 +197,7 @@
|
||||
<a class="sourceLine" id="cb2-11" title="11"> <span class="cf">for</span> (<span class="dt">int64_t</span> i=<span class="dv">0</span>; i<cnt; ++i) <span class="co">// iterate over all values</span></a>
|
||||
<a class="sourceLine" id="cb2-12" title="12"> {</a>
|
||||
<a class="sourceLine" id="cb2-13" title="13"> <span class="dt">unsigned</span> <span class="dt">int</span> key = rsu.next(); <span class="co">// get next key to insert</span></a>
|
||||
<a class="sourceLine" id="cb2-14" title="14"> <span class="dt">size_t</span> hashval = hasher(key); <span class="co">// compute its hash</span></a>
|
||||
<a class="sourceLine" id="cb2-14" title="14"> <span class="dt">size_t</span> hashval = hash.hash(key); <span class="co">// compute its hash</span></a>
|
||||
<a class="sourceLine" id="cb2-15" title="15"> <span class="dt">size_t</span> idx = hash.subidx(hashval); <span class="co">// compute the submap index for this hash</span></a>
|
||||
<a class="sourceLine" id="cb2-16" title="16"> <span class="cf">if</span> (idx / modulo == thread_idx) <span class="co">// if the submap is suitable for this thread</span></a>
|
||||
<a class="sourceLine" id="cb2-17" title="17"> {</a>
|
||||
|
||||
Vendored
+1
-2
@@ -144,13 +144,12 @@ void _fill_random_inner_mt(int64_t cnt, HT &hash, RSU &rsu)
|
||||
std::unique_ptr<std::thread> threads[num_threads];
|
||||
|
||||
auto thread_fn = [&hash, cnt, num_threads](int64_t thread_idx, RSU rsu) {
|
||||
typename HT::hasher hasher; // get hasher object from the hash table
|
||||
size_t modulo = hash.subcnt() / num_threads; // subcnt() returns the number of submaps
|
||||
|
||||
for (int64_t i=0; i<cnt; ++i) // iterate over all values
|
||||
{
|
||||
unsigned int key = rsu.next(); // get next key to insert
|
||||
size_t hashval = hasher(key); // compute its hash
|
||||
size_t hashval = hash.hash(key); // compute its hash
|
||||
size_t idx = hash.subidx(hashval); // compute the submap index for this hash
|
||||
if (idx / modulo == thread_idx) // if the submap is suitable for this thread
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user