c/c++ 使用比long long还大的类型

来源:互联网 发布:mac os 未能验证更新 编辑:程序博客网 时间:2024/05/16 12:02

当发现long long的值不足以存放一些组合数值的时候,可以考虑使用__int128


如果发现所在的环境并不能支持__int128的数据类型的时候,可能需要考虑自己编写相应的struct类型来拓展符合自己的__int128位

如:

struct MyInt128 {

long long x;

long long y;

bool operator <(const struct MyInt128 &t) {...}

bool operator <=(const struct MyInt128 &t) {...}

bool operator >..

bool operator >=..

bool operator ==...

bool operator !=...

};

0 0