Fixes undefined behavior from shifting into signed bit; use unsigned literal instead

This commit is contained in:
Daniel J. Hofmann 2015-06-02 12:54:55 +02:00
parent b2d444d782
commit bcc41bf3d1

View File

@ -57,7 +57,7 @@ uint64_t HilbertCode::BitInterleaving(const uint32_t latitude, const uint32_t lo
void HilbertCode::TransposeCoordinate(uint32_t *X) const
{
uint32_t M = 1 << (32 - 1), P, Q, t;
uint32_t M = 1u << (32 - 1), P, Q, t;
int i;
// Inverse undo
for (Q = M; Q > 1; Q >>= 1)