source:
Deliverables/D4.1/GCC/BranchlessMin.c
@
297
Last change on this file since 297 was 172, checked in by , 11 years ago | |
---|---|
File size: 168 bytes |
Rev | Line | |
---|---|---|
[172] | 1 | int branchless_min(int x, int y) |
2 | { | |
3 | return y ^ ((x ^ y) & -(x < y)); | |
4 | } | |
5 | ||
6 | int 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.