zOrder function
Implementation
int zOrder(double x0, double y0, double minX, double minY, double invSize) {
// coords are transformed into non-negative 15-bit integer range
int x = (32767 * (x0 - minX) * invSize).floor();
int y = (32767 * (y0 - minY) * invSize).floor();
x = (x | (x << 8)) & 0x00FF00FF;
x = (x | (x << 4)) & 0x0F0F0F0F;
x = (x | (x << 2)) & 0x33333333;
x = (x | (x << 1)) & 0x55555555;
y = (y | (y << 8)) & 0x00FF00FF;
y = (y | (y << 4)) & 0x0F0F0F0F;
y = (y | (y << 2)) & 0x33333333;
y = (y | (y << 1)) & 0x55555555;
return x | (y << 1);
}