Use explicit type to compare integer

This commit is contained in:
halx99 2021-11-09 14:40:00 +08:00
parent 95a1734cd7
commit 0f0b3b95eb
1 changed files with 9 additions and 4 deletions

View File

@ -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: