[Bf-blender-cvs] [ff7bba8dad5] master: Fix: Integer type in linear probing strategy

Hans Goudey noreply at git.blender.org
Thu Sep 8 16:55:31 CEST 2022


Commit: ff7bba8dad5d09f8b3e53a9a31a5f5fa50099b44
Author: Hans Goudey
Date:   Thu Sep 8 09:52:42 2022 -0500
Branches: master
https://developer.blender.org/rBff7bba8dad5d09f8b3e53a9a31a5f5fa50099b44

Fix: Integer type in linear probing strategy

Probing strategies must iterate over every possible hash, but the linear
strategy only did 2^32 iterations, not 2^64. Updating this was missed
in 8cbbdedaf4dfec9e3. Also fix an unnecessary comma.

Differential Revision: https://developer.blender.org/D15913

===================================================================

M	source/blender/blenlib/BLI_probing_strategies.hh

===================================================================

diff --git a/source/blender/blenlib/BLI_probing_strategies.hh b/source/blender/blenlib/BLI_probing_strategies.hh
index c6152e4d03d..2c001270495 100644
--- a/source/blender/blenlib/BLI_probing_strategies.hh
+++ b/source/blender/blenlib/BLI_probing_strategies.hh
@@ -2,6 +2,8 @@
 
 #pragma once
 
+#include <numeric>
+
 /** \file
  * \ingroup bli
  *
@@ -20,7 +22,7 @@
  * clustering issues. However, more linear steps can also make things slower when the initial hash
  * produces many collisions.
  *
- * Every probing strategy has to guarantee, that every possible uint64_t is returned eventually.
+ * Every probing strategy has to guarantee that every possible uint64_t is returned eventually.
  * This is necessary for correctness. If this is not the case, empty slots might not be found.
  *
  * The SLOT_PROBING_BEGIN and SLOT_PROBING_END macros can be used to implement a loop that iterates
@@ -69,7 +71,7 @@ class LinearProbingStrategy {
 
   int64_t linear_steps() const
   {
-    return UINT32_MAX;
+    return std::numeric_limits<int64_t>::max();
   }
 };



More information about the Bf-blender-cvs mailing list