Created
November 26, 2010 12:39
-
-
Save anonymous/716660 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| inline int max(int a, int b){ | |
| //return a > b ? a : b; | |
| //return (-(a>b))&a|(~(-(a>b)))&b; | |
| int c=a>b; return c*a+!c*b; | |
| } | |
| int main(int argc, char** argv) | |
| { | |
| int xs[10000]; | |
| for(int i = 0; i < 10000; i++){ | |
| xs[i] = xor128(); | |
| } | |
| int dummy = 0; | |
| TimeStat t("sample"); | |
| for(int iter = 0; iter < 20; iter++){ | |
| t.start(); | |
| for(int i = 0; i < 10000; i++){ | |
| for(int j = 0; j < 10000; j++){ | |
| dummy += max(xs[i], xs[j]); | |
| } | |
| } | |
| t.end(); | |
| } | |
| t.print(); | |
| printf("dummy: %d\n", dummy); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment