From 59261a95569dfb40a42f7cbb6f2d83add5ccac60 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs@hunt.opencfd.co.uk>
Date: Thu, 8 Jan 2009 18:13:52 +0000
Subject: [PATCH] hash overflow

---
 src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H
index 292bb61cfa0..40db9f8b170 100644
--- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H
+++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H
@@ -54,6 +54,7 @@ SourceFiles
 #define fvMeshDistribute_H
 
 #include "Field.H"
+#include "uLabel.H"
 #include "fvMeshSubset.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -114,14 +115,12 @@ class fvMeshDistribute
             labelPairHash()
             {}
 
-            label operator()(const labelPair& p) const
+            label operator()(const labelPair& p, const uLabel tableSize) const
             {
-                return label(p[0]*p[0]+p[0]+p[1]);
-            }
-
-            label operator()(const labelPair& p, const label tableSize) const
-            {
-                return mag(operator()(p)) % tableSize;
+                uLabel p0 = static_cast<uLabel>(p[0]);
+                uLabel p1 = static_cast<uLabel>(p[1]);
+                uLabel key = p0*p0+p0+p1;
+                return key % tableSize;
             }
         };
 
-- 
GitLab