[Bf-blender-cvs] [23c31ec27d7] functions: add float hash

Jacques Lucke noreply at git.blender.org
Sun Aug 25 14:35:01 CEST 2019


Commit: 23c31ec27d7291874082029ec1f074976878772d
Author: Jacques Lucke
Date:   Sun Aug 25 14:34:10 2019 +0200
Branches: functions
https://developer.blender.org/rB23c31ec27d7291874082029ec1f074976878772d

add float hash

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

M	source/blender/blenlib/BLI_hash.hpp

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

diff --git a/source/blender/blenlib/BLI_hash.hpp b/source/blender/blenlib/BLI_hash.hpp
index e6fd5c3ad6f..21c97fa1b44 100644
--- a/source/blender/blenlib/BLI_hash.hpp
+++ b/source/blender/blenlib/BLI_hash.hpp
@@ -28,6 +28,13 @@ TRIVIAL_DEFAULT_INT_HASH(int32_t);
 TRIVIAL_DEFAULT_INT_HASH(uint32_t);
 TRIVIAL_DEFAULT_INT_HASH(int64_t);
 
+template<> struct DefaultHash<float> {
+  uint32_t operator()(float value) const
+  {
+    return *(uint32_t *)&value;
+  }
+};
+
 template<> struct DefaultHash<std::string> {
   uint32_t operator()(const std::string &value) const
   {



More information about the Bf-blender-cvs mailing list