We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b5a35ed commit 7a8ec2aCopy full SHA for 7a8ec2a
octomap/include/octomap/OcTreeKey.h
@@ -96,8 +96,10 @@ namespace octomap {
96
/// Provides a hash function on Keys
97
struct KeyHash{
98
size_t operator()(const OcTreeKey& key) const{
99
- // a hashing function
100
- return key.k[0] + 1337*key.k[1] + 345637*key.k[2];
+ // a simple hashing function
+ // explicit casts to size_t to operate on the complete range
101
+ // constanst will be promoted according to C++ standard
102
+ return size_t(key.k[0]) + 1447*size_t(key.k[1]) + 345637*size_t(key.k[2]);
103
}
104
};
105
0 commit comments