Skip to main content

Mojo function

morton_decode_2d_rect

morton_decode_2d_rect(flat_idx: UInt32, log2_m: UInt32, log2_n: UInt32) -> Tuple[UInt32, UInt32]

Decode flat_idx to (tile_m, tile_n) over a (1<<log2_m) x (1<<log2_n) grid.

Z-order covers a min(side_m, side_n) square core; remaining bits sweep the longer axis. Reduces to morton_decode_2d when log2_m == log2_n.

Returns:

Tuple[UInt32, UInt32]