You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The lines that compute checkbits (the curve order or bits per dimension) currently use floating-point math, including floor(), which is not a trivial function, depending perhaps on the floating point handling, i.e. /fp:strict.
This code can be replaced with the following:
unsigned int checkbits = (sizeof(morton) * 8) / 3;
This uses integer division, includes no function call, and gives the same results in all cases.
The key to this working is the order of operations - doing the multiply first gives an intermediate result of 64 or 32. Dividing this by three yields 21 or 10, as desired.
The text was updated successfully, but these errors were encountered:
The for-loop path is purely there for educational purposes (since it is the most transparent but slowest method to compute morton codes), but this is a nice improvement anyway.
The lines that compute checkbits (the curve order or bits per dimension) currently use floating-point math, including floor(), which is not a trivial function, depending perhaps on the floating point handling, i.e. /fp:strict.
Here's an example:
libmorton/include/libmorton/morton3D.h
Line 129 in 6d22725
This code can be replaced with the following:
unsigned int checkbits = (sizeof(morton) * 8) / 3;
This uses integer division, includes no function call, and gives the same results in all cases.
The key to this working is the order of operations - doing the multiply first gives an intermediate result of 64 or 32. Dividing this by three yields 21 or 10, as desired.
The text was updated successfully, but these errors were encountered: