I would suggest using a function pointer. It costs one comprason before the loop then one extra register. Provided the compiler can spare a register then it should have no cost on the loop.

Or I suppose fixing the crashes would be wiser.