Optimising switching algorithms based on value of struct field

Maybe you want