Abstract-- Dilated integers form an ordered group of the cartesian indices into a d-dimensional array represented in Morton order. Efficient implementations of its operations can be found elsewhere; this paper offers efficient casting (type)conversions to and from ordinary integer representation. As Morton-order representation for two- and three-dimensional arrays attracts more users because of its excellent block locality, the efficiency of these conversions becomes important. They are essential for programmers who would use cartesian indexing there. Two algorithms for each casting conversion are presented here: including to-and-from dilated integers, for both d = 2 and d = 3. They fall into two families. One family uses newly compact table-lookup so cache capacity is better preserved. The other generalizes better to all d, using processor-local arithmetic that presented as abstract d-ary and (d-1)-ary recurrences. Test results for 2 and 3 dimensions generally favor the former. CCS Ca...
Rajeev Raman, David S. Wise