假设我们的系统不支持 64 位计算,但支持 32 位计算,请申明一个 MyINT64 类,并实现其中的加法。
RT弱弱的求个详细的思路和解释
拜托了,各位大神
2014-09-11 21:29
2014-09-12 10:16
程序代码:struct MyINT64
{
int int32high;
unsigned uint32low;
};
MyINT64 operator+( const MyINT64& a, const MyINT64& b )
{
MyINT64 r;
r.uint32low = a.uint32low + b.uint32low;
r.int32high = a.int32high + b.int32high + (r.uint32low<a.uint32low || r.uint32low<b.uint32low);
return r;
}
2014-09-12 15:42