mirror of https://github.com/axmolengine/axmol.git
Use explicit type to compare integer
This commit is contained in:
parent
95a1734cd7
commit
0f0b3b95eb
|
@ -386,11 +386,16 @@ bool Value::operator==(const Value& v) const
|
|||
return false;
|
||||
if (this->isNull())
|
||||
return true;
|
||||
switch (getTypeFamily())
|
||||
switch (getType())
|
||||
{
|
||||
case Type::INTEGER:
|
||||
return 0 ==
|
||||
memcmp(&_field.int64Val, &v._field.int64Val, ((uint32_t)_type & (uint32_t)Type::MASK_64BIT) ? sizeof(int64_t) : sizeof(int));
|
||||
case Type::INT_I32:
|
||||
return v._field.intVal == this->_field.intVal;
|
||||
case Type::INT_UI32:
|
||||
return v._field.uintVal == this->_field.uintVal;
|
||||
case Type::INT_I64:
|
||||
return v._field.int64Val == this->_field.int64Val;
|
||||
case Type::INT_UI64:
|
||||
return v._field.int64Val == this->_field.int64Val;
|
||||
case Type::BOOLEAN:
|
||||
return v._field.boolVal == this->_field.boolVal;
|
||||
case Type::STRING:
|
||||
|
|
Loading…
Reference in New Issue