I tried to compute power function using binary exponential method. During which I found some blogs using __uint128_t and I tried to use it but I was getting an error. This is my code
using u64 = uint64_t;
u64 binpower(u64 base, u64 e, u64 mod) {
u64 result = 1;
base %= mod;
while (e) {
if (e & 1)
result = (__uint128_t)result * base % mod;
base = (__uint128_t)base * base % mod;
e >>= 1;
}
return result;
}
I also referred this stating that it was available from GCC >= 4.6. I was using gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)
.