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

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -