Branchless Programming: Difference between revisions

Line 14: Line 14:
==Switch Statements==
==Switch Statements==
Technically, switch statements are still branches.
Technically, switch statements are still branches.
However, they can lead to a negligible performance gains if there are lots of cases.
However, they can lead to a negligible performance gains if there are lots of cases.
Only convert if to switch if switch statements are significantly more readable in your scenario.
Only convert if statements to switch statements when they are significantly more readable in your scenario.


==Polymorphism==
==Polymorphism==