Added more consts to arguments of static inline functions. This probably makes no difference for modern compilers, but it can't hurt...
Use the dimension ordering of the caller