Open WildRackoon opened 11 months ago
Somewhat related to https://github.com/Forceflow/libmorton/issues/41
Having to manage both uint_fast32_t / uint_fast16_t or uint_fast64_t / uint_fast32_t is not easy, especially with templated code:
uint_fast32_t
uint_fast16_t
uint_fast64_t
The following overload: inline void morton2D_32_decode(const uint_fast32_t morton, uint_fast16_t& x, uint_fast16_t& y);
inline void morton2D_32_decode(const uint_fast32_t morton, uint_fast16_t& x, uint_fast16_t& y);
Should also offer the following overload by casting: inline void morton2D_32_decode(const uint_fast32_t morton, uint_fast32_t & x, uint_fast32_t & y);
inline void morton2D_32_decode(const uint_fast32_t morton, uint_fast32_t & x, uint_fast32_t & y);
This brings up the fact that it could use a templated implementation to allow that kind of overloads:
template<typename T, typename U> inline void morton2D_32_decode(const T morton, U& x, U& y);
Implementation should static_assert that both T and U are unsigned and optionnaly that there are enough std::numeric_limits<>::digits between each other.
T
U
std::numeric_limits<>::digits
Somewhat related to https://github.com/Forceflow/libmorton/issues/41
Having to manage both
uint_fast32_t
/uint_fast16_t
oruint_fast64_t
/uint_fast32_t
is not easy, especially with templated code:The following overload:
inline void morton2D_32_decode(const uint_fast32_t morton, uint_fast16_t& x, uint_fast16_t& y);
Should also offer the following overload by casting:
inline void morton2D_32_decode(const uint_fast32_t morton, uint_fast32_t & x, uint_fast32_t & y);
This brings up the fact that it could use a templated implementation to allow that kind of overloads:
Implementation should static_assert that both
T
andU
are unsigned and optionnaly that there are enoughstd::numeric_limits<>::digits
between each other.