#include #include int main(void) { // uint64_t x = 0x10000000; uint64_t x = 0x10000; uint64_t y = 0, i; for (i = 0; i < 20000000000; i++) { #if 0 x += x * x; #else x += (uint64_t)(uint32_t)x * (uint32_t)x; #endif if (x == y) fprintf(stderr, "%llu (0x%llx): %llu (0x%llx)\n", (unsigned long long)i, (unsigned long long)i, (unsigned long long)x, (unsigned long long)x); if ((i & (i - 1)) == 0) y = x; // fwrite(&x, sizeof(x), 1, stdout); } return 0; }