c - 2d Morton code 64bits decode function -
the first function encodes [x, y] 64bit wide morton code x , y 32bit wide integers using interleave bits binary magic numbers.
what reverse function ?
void xy2d_morton_64bits(uint64_t x, uint64_t y, uint64_t *d) { x = (x | (x << 16)) & 0x0000ffff0000ffff; x = (x | (x << 8)) & 0x00ff00ff00ff00ff; x = (x | (x << 4)) & 0x0f0f0f0f0f0f0f0f; x = (x | (x << 2)) & 0x3333333333333333; x = (x | (x << 1)) & 0x5555555555555555; y = (y | (y << 16)) & 0x0000ffff0000ffff; y = (y | (y << 8)) & 0x00ff00ff00ff00ff; y = (y | (y << 4)) & 0x0f0f0f0f0f0f0f0f; y = (y | (y << 2)) & 0x3333333333333333; y = (y | (y << 1)) & 0x5555555555555555; *d = x | (y << 1); } void d2xy_morton_64bits(uint64_t d, uint64_t *x, uint64_t *y) { ???? }
Comments
Post a Comment