summaryrefslogtreecommitdiff
path: root/core/hashfuncs.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/hashfuncs.h')
-rw-r--r--core/hashfuncs.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/hashfuncs.h b/core/hashfuncs.h
index a917ee5edb..e9e57d8b42 100644
--- a/core/hashfuncs.h
+++ b/core/hashfuncs.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -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;
}