source:
Deliverables/D4.1/GCC/BranchlessMin.c
@
185
Last change on this file since 185 was 172, checked in by , 10 years ago | |
---|---|
File size: 168 bytes |
Line | |
---|---|
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.