处理long问题

This commit is contained in:
aozhiwei 2018-10-31 10:25:36 +08:00
parent 24f2912dbf
commit 55c5492183

View File

@ -119,15 +119,21 @@ namespace a8
void XValue::Set(long v) void XValue::Set(long v)
{ {
OnReset(); OnReset();
type_ = XVT_INT; if (sizeof(long) == 8) {
value_.int_value = v; Set((long long)v);
} else {
Set((int)v);
}
} }
void XValue::Set(unsigned int v) void XValue::Set(unsigned int v)
{ {
OnReset(); OnReset();
type_ = XVT_UINT; if (sizeof(long) == 8) {
value_.int_value = v; Set((unsigned long long)v);
} else {
Set((unsigned int)v);
}
} }
void XValue::Set(unsigned long v) void XValue::Set(unsigned long v)
@ -407,13 +413,21 @@ namespace a8
XValue::operator long() const XValue::operator long() const
{ {
if (sizeof(long) == 8) {
return GetInt64();
} else {
return GetInt(); return GetInt();
} }
}
XValue::operator unsigned long() const XValue::operator unsigned long() const
{ {
if (sizeof(long) == 8) {
return GetUInt64();
} else {
return GetUInt(); return GetUInt();
} }
}
XValue::operator double() const XValue::operator double() const
{ {