Skip to content

Commit

Permalink
Fix a bug for 64-bit 2D Morton codes
Browse files Browse the repository at this point in the history
We do (1 << 31). The problem is that MAX_INT (which is 2147483647) is
smaller than that, which leads to overflow.
  • Loading branch information
aprokop committed Feb 22, 2022
1 parent 3631580 commit feddbd0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/details/ArborX_DetailsMortonCode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ unsigned long long morton64(float x, float y)
{
// The interval [0,1] is subdivided into 2,147,483,648 bins (in each
// direction).
constexpr unsigned N = (1 << 31);
constexpr unsigned N = (1u << 31);

using KokkosExt::max;
using KokkosExt::min;
Expand Down

0 comments on commit feddbd0

Please sign in to comment.