rotifer·الشهر الماضي·discussAt the bottom of the page there's a link, "When ‘if’ slows you down, avoid it" [1], that discusses these exact questions. It's basically what @josephg said, but it also shows the assembly language for each version.[1] https://tiki.li/blog/branchless
[1] https://tiki.li/blog/branchless