Changes

Jump to: navigation, search

Avoiding Branches

18 bytes added, 10:37, 7 December 2018
no edit summary
=Abs, Max, Min=
It is recommend to use functions provided by the [[Languages|programming language]]. In [[C]] or [[Cpp|C++]] one should use appropriate compiler intrinsics and/or template functions provided by the [[C#Runtime|C Runtime Library]] or [[Cpp#STL|Standard Template Library]].
The tricks shown here, might be useful if compiler don't support those functions or don't generate the intended branchless assembly and the input is quite random, so that the branch prediction heuristics will fail often.

Navigation menu