Created
October 12, 2012 04:23
-
-
Save mtekk/3877285 to your computer and use it in GitHub Desktop.
A rollover detection test
This file contains 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
//A rollover detection test | |
//Try compiling using: g++ rollovertest.cpp -02 -orollover | |
//Run as ./rollover | |
//If it hangs your GCC is not behaving correctly | |
//Based off of code seen in the HINT benchmark | |
#include <iostream> | |
int main() | |
{ | |
int i(0), j(0), iter(0); | |
i = 1; | |
j = i + i; | |
while(j > 0) | |
{ | |
iter++; | |
i += i; | |
j += j; | |
} | |
std::cout << "Bits " << iter << " Max: " << i << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment