Skip to content

Instantly share code, notes, and snippets.

@mtekk
Created October 12, 2012 04:23
Show Gist options
  • Save mtekk/3877285 to your computer and use it in GitHub Desktop.
Save mtekk/3877285 to your computer and use it in GitHub Desktop.
A rollover detection test
//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