
on 14.08.2009 at 21:32 joel wrote :
looks smart and tricky but i don't see any advantages over computed indeces but only wasted spaces and time (for allocating additiona storage for pointers)
This si a trade-off. Beware that's only the allocating is slightly slower as the malloc itslef takes more time than the small loop.
at the same time dereferencing a pointer is like computing an index Look at generated assembly and you'll see what happen. At worst it's the same. At best, it replace all the idnex computation by a single LEA on INTEL. Also, it ease writing code that need to deal with multiple idnex. for big sizes it might be better i agree
Index computation with dim > 2 becomes impractical when you ned to do thign like extarcting non rectangular area or doing tile blocking. so i guess there should be at least two versions of storages
-- Pavel