Skip to content

Commit

Permalink
Fix crash when using key cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Zylann committed Apr 17, 2024
1 parent 19faf4b commit 6a43b56
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/source/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Primarily developped with Godot 4.2.
- Fixed wrapping error with the `Image` node in negative coordinates
- Fixed wrong behavior and crashes when generating chunks large enough to trigger the "subdivision" feature
- `VoxelInstanceLibraryMultimeshItem`: fixed error when using "Update From Scene" and trying to undo/redo it
- `VoxelStreamSQLite`: fixed crash when using `set_key_cache_enabled(true)`
- `VoxelTool`: fixed `paste` wrongly printing an error despite working fine
- `VoxelToolLodTerrain`:
- `do_point` and `set_voxel` were not always updating meshes near chunk borders, leaving holes
Expand Down
4 changes: 2 additions & 2 deletions util/math/vector3i16.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ typedef Vector3T<int16_t> Vector3i16;

inline size_t get_hash_st(const zylann::Vector3i16 &v) {
// TODO Optimization: benchmark this hash, I just wanted one that works
uint64_t m = 0;
*(zylann::Vector3i16 *)m = v;
// static_assert(sizeof(zylann::Vector3i16) <= sizeof(uint64_t));
const uint64_t m = v.x | (static_cast<uint64_t>(v.y) << 16) | (static_cast<uint64_t>(v.z) << 32);
return std::hash<uint64_t>{}(m);
}

Expand Down

0 comments on commit 6a43b56

Please sign in to comment.