Skip to content

Commit

Permalink
Remove redundant Modulus operation for Vocel Hash function, set robin…
Browse files Browse the repository at this point in the history
… map params instead
  • Loading branch information
saurabh1002 committed Jul 4, 2024
1 parent b380b8b commit dc9ae0e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cpp/kiss_icp/core/VoxelHashMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@ struct VoxelHashMap {
struct VoxelHash {
size_t operator()(const Voxel &voxel) const {
const uint32_t *vec = reinterpret_cast<const uint32_t *>(voxel.data());
return ((1 << 20) - 1) & (vec[0] * 73856093 ^ vec[1] * 19349669 ^ vec[2] * 83492791);
return (vec[0] * 73856093 ^ vec[1] * 19349669 ^ vec[2] * 83492791);
}
};

explicit VoxelHashMap(double voxel_size, double max_distance, int max_points_per_voxel)
: voxel_size_(voxel_size),
max_distance_(max_distance),
max_points_per_voxel_(max_points_per_voxel) {}
max_points_per_voxel_(max_points_per_voxel),
map_(1 << 16) {
map_.min_load_factor(0.05f);
map_.max_load_factor(0.75f);
}

inline void Clear() { map_.clear(); }
inline bool Empty() const { return map_.empty(); }
Expand Down

0 comments on commit dc9ae0e

Please sign in to comment.