summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-10-17 09:41:39 +0200
committerGitHub <noreply@github.com>2016-10-17 09:41:39 +0200
commitfb257f7f24cd8e0bc5ecef2e7c244232febb6aa6 (patch)
tree2600bddcf90fe04c3fafd08527ed5d98276805bc /core
parent31e0e9536270e8973a9a42912517da7dd481fdb2 (diff)
parent9ad0850301045e0d7fd243340e807fb2c9f736de (diff)
Merge pull request #6698 from razvanc-r/fix_hash_float
Fixes hash float negative 0 problem
Diffstat (limited to 'core')
-rw-r--r--core/hashfuncs.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/hashfuncs.h b/core/hashfuncs.h
index a917ee5edb..6c029a3458 100644
--- a/core/hashfuncs.h
+++ b/core/hashfuncs.h
@@ -74,7 +74,10 @@ static inline uint32_t hash_djb2_one_float(float p_in,uint32_t p_prev=5381) {
float f;
uint32_t i;
} u;
- u.f=p_in;
+
+ // handle -0 case
+ if (p_in==0.0f) u.f=0.0f;
+ else u.f=p_in;
return ((p_prev<<5)+p_prev)+u.i;
}