its so the compiler can remove the constants (like invert and stride) out of the loops.
possibly there would not be much impact if we duplicate it for invert and make it non inlineable, but I prefer to let the compiler take that decision.