source: Deliverables/D4.1/GCC/BranchlessMin.c

Last change on this file was 172, checked in by mulligan, 10 years ago

JZ was not buggy after all (miscount of loop cycles). Branchless
minimum example added.

File size: 168 bytes
RevLine 
[172]1int branchless_min(int x, int y)
2{
3  return y ^ ((x ^ y) & -(x < y));
4}
5
6int main()
7{
8  int z = branchless_min(5, 7);
9  if(z == 5)
10    return 5;
11  else
12    return 7;
13}
Note: See TracBrowser for help on using the repository browser.