// Test long vs long long
#include <iostream>
int main()
{
unsignedlonglong x(~0), y(0), z(x);
for (; z > 0; ++y, z /= 2);
std::cout << x << " = 2^" << y << "-1";
}
long long or long only makes not difference. Or is there an option I've overlooked?
On gcc you can include <cstdint> and try __int128_t or __uint128_t.
I don't think cout knows how to output them, though, so you may have to write your own output routine.
On gcc you can include <cstdint> and try __int128_t or __uint128_t.
1 2 3 4 5 6 7 8 9 10 11
// Test __uint128_t vs long long
#include <iostream>
#include <cstdint>
int main()
{
__uint128_t x(~0), z(x);
unsigned y(0);
for (; z > 0; ++y, z /= 2);
std::cout << "x = 2^" << y << "-1";
}