Skip to content

Instantly share code, notes, and snippets.

@Ono-Sendai
Created November 29, 2017 00:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ono-Sendai/cd9552809431911faa14b6841306f415 to your computer and use it in GitHub Desktop.
Save Ono-Sendai/cd9552809431911faa14b6841306f415 to your computer and use it in GitHub Desktop.
#include <cmath>
static inline float f(float x)
{
// Do some random computations, to make this function sufficiently complicated
const float y = std::sin(x)*x + std::cos(x);
float z = 0;
for(int z=0; z<(int)x; ++z)
z += std::pow(x, y);
for(int z=0; z<(int)x; ++z)
z += std::pow(x, y);
for(int z=0; z<(int)x; ++z)
z += std::pow(x, y);
for(int z=0; z<(int)x; ++z)
z += std::pow(x, y);
for(int z=0; z<(int)x; ++z)
z += std::pow(x, y);
for(int z=0; z<(int)x; ++z)
z += std::pow(x, y);
z += y;
for(int q=0; q<300; ++q)
z += std::exp(q);
return z;
}
__declspec(noinline) int g(int x)
{
return f(x);
}
int main(int argc, char** argv)
{
return g(argc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment