Changed how murmur hash was used in find_max_factor_graph_nmplp to avoid a

violation of the strict aliasing rule.  This fixes a bug which caused
find_max_factor_graph_nmplp() to not work properly on some compilers.
This commit is contained in:
Davis King 2012-12-27 15:56:56 -05:00
parent 453fee6235
commit 7ae702a49f

View File

@ -40,8 +40,7 @@ namespace dlib
- #(*this)(a,b) == value
!*/
{
const unsigned long block[2] = {a,b};
const uint32 h = murmur_hash3(&block[0], sizeof(block))%(data.size()-scan_dist);
const uint32 h = murmur_hash3_2(a,b)%(data.size()-scan_dist);
const unsigned long empty_bucket = std::numeric_limits<unsigned long>::max();
@ -85,8 +84,7 @@ namespace dlib
DLIB_ASSERT(a != b, "An invalid map_problem was given to find_max_factor_graph_nmplp()."
<< "\nNode " << a << " is listed as being a neighbor with itself, which is illegal.");
const unsigned long block[2] = {a,b};
uint32 h = murmur_hash3(&block[0], sizeof(block))%(data.size()-scan_dist);
uint32 h = murmur_hash3_2(a,b)%(data.size()-scan_dist);
for (unsigned long i = 0; i < scan_dist; ++i)