primitives - buildLinearIndexArray improved